umkm-app/application/controllers/Produk.php

39 lines
676 B
PHP

<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Produk extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->load->model("UserModel");
$this->load->model("ProdukModel");
$this->load->model("UmkmModel");
}
public function index()
{
$data['listproduk'] = $this->ProdukModel->getProduk();
$data['user_logged'] = $this->session->userdata('user_logged');
$this->load->view('produk',$data);
}
public function getdata()
{
$listproduk['data'] = $this->ProdukModel->getProduk();
$json = json_encode($listproduk);
echo $json;
}
}