<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Detail extends CI_Controller {

	public function produk($slug = null) {
		$arr  	= explode('-', $slug);
		$id     = end($arr);
		$produk = $this -> app -> get_produk(['id' => $id]);
		
		if($produk) {
			$conf = [
				'title'        => $produk -> nama  . ' | ' . app('app_name'),
				'navtop'       => true,
				'mobmenu'      => true,
				'search_input' => true,
				'header_right' => true,
				'loading' 	   => true,
				'footer' 	   => true,
				'page_title'   => $produk -> nama,
				'produk'  	   => $produk,
			];
	
			$this -> load -> view('layout/head', $conf);
			$this -> load -> view('layout/header');
			$this -> load -> view('detail_produk');
			$this -> load -> view('layout/floating-chat');
			$this -> load -> view('layout/footer');
		}
	}

	function add() {
		// $data = $this -> app -> get_produk();
		$data = $this -> app -> get_produk(
			[
				'limit'  => 10,
                'random' => false
			]
		);
		echo '<pre>';
		print_r($data);

	}
}

// Controller Detail
// Kode ini dibuat oleh codelingker