-
Notifications
You must be signed in to change notification settings - Fork 15
Controller
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}
}
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
Module Structure
- [controller] (https://github.com/mangopik/Sximo-Laravel/wiki/Controller)
- Model
- views
BaseController
- [Function getDownload()] (https://github.com/mangopik/Sximo-Laravel/wiki/function-getDownload%28%29)
- Function trackUriSegment()
- [Function getComboselect()] (https://github.com/mangopik/Sximo-Laravel/wiki/Function-getComboselect)
- [Function validatePost()] (https://github.com/mangopik/Sximo-Laravel/wiki/function-validatePost)
- [Function validateForm()] (https://github.com/mangopik/Sximo-Laravel/wiki/Function-validateForm)
- [Function validAccess()] (https://github.com/mangopik/Sximo-Laravel/wiki/Function-ValidAccess)
- [Function inputLogs()] (https://github.com/mangopik/Sximo-Laravel/wiki/Function-inputLogs)
- [Function buildSearch()] (https://github.com/mangopik/Sximo-Laravel/wiki/Function-buildSearch)
- [Function masterDetailParam()] (#)
BaseModel
- [Function makeInfo()] (https://github.com/mangopik/Sximo-Laravel/wiki/Function-makeInfo)
- [Function getRows()] (https://github.com/mangopik/Sximo-Laravel/wiki/Function-getRows)
- [Function getRow()] (https://github.com/mangopik/Sximo-Laravel/wiki/Function-getRow)
- [Function insetRow()] (https://github.com/mangopik/Sximo-Laravel/wiki/Function-insertRow)
SiteHelpers
- [Function avatar()] (#)
- [Function alert()] (https://github.com/mangopik/Sximo-Laravel/wiki/Function-alert)
- [Function encryptID()] (https://github.com/mangopik/Sximo-Laravel/wiki/Function-encryptID)
- [Function gridDisplay()] (#)
- [Function langOption()] (https://github.com/mangopik/Sximo-Laravel/wiki/Function-langOption)