Skip to content
Taufik Firmansyah edited this page Jan 29, 2015 · 11 revisions

Controller Class structure

class YourmoduleController extends BaseController {
	
	public function __construct(){	parent::__construct();	} 
	
	public function getIndex(){// displaying data}		

	public function getAdd( $id = null) {// edit or add new row}
	
	public function getShow( $id = null){// view detail selection row}	
	
	public function postSave( $id =0){// save or update current row	}
	
	public function postDestroy(){// removew current row}		
}

public function __construct()

This is important part of controller .

Make sure all parent function are available for controller

parent::__construct();

Initialize Model for current controller and make it available for all function inside this controller

$this->model = new Yourmodule();

Get all module configuration and make it available for all function inside this controller

$this->info = $this->model->makeInfo( $this->module);

please refference to function [Function makeInfo()] (https://github.com/mangopik/Sximo-Laravel/wiki/Function-makeInfo)


Get Access Permission settion for current controller and make it available for all function inside this controller

$this->access = $this->model->validAccess($this->info['id']);

the result will contain array task permission info for group users

{
"is_view" : "1" ,
"is_detail" : "1" 
"is_edit" : "1" ,
"is_add"  : "1",
"is_remove" : "1",
"is_global" : "1",
"is_excel" : "1",

}
// Note : 1 is allowed , 0 is not allowed

public function getIndex()

Module Structure

BaseController

BaseModel

SiteHelpers

Clone this wiki locally