@@ -149,21 +149,21 @@ |
||
149 | 149 | <?php |
150 | 150 | $font = new \crocodicstudio\crudbooster\helpers\FontAwesome(); |
151 | 151 | $fontData = [ |
152 | - ["data"=>$font->text(),"label"=>"Text"], |
|
153 | - ["data"=>$font->web(),"label"=>"Web"], |
|
154 | - ["data"=>$font->video(),"label"=>"Video"], |
|
155 | - ["data"=>$font->transportation(),"label"=>"Transportation"], |
|
156 | - ["data"=>$font->payment(),"label"=>"Payment"], |
|
157 | - ["data"=>$font->medical(),"label"=>"Medical"], |
|
158 | - ["data"=>$font->hand(),"label"=>"Hand"], |
|
159 | - ["data"=>$font->fileType(),"label"=>"File Type"], |
|
160 | - ["data"=>$font->directional(),"label"=>"Directional"], |
|
161 | - ["data"=>$font->currency(),"label"=>"Currency"], |
|
162 | - ["data"=>$font->chart(),"label"=>"Chart"], |
|
163 | - ["data"=>$font->brands(),"label"=>"Brand"], |
|
164 | - ["data"=>$font->gender(),"label"=>"Gender"], |
|
165 | - ["data"=>$font->form(),"label"=>"Form"], |
|
166 | - ["data"=>$font->spinner(),"label"=>"Spinner"] |
|
152 | + ["data"=>$font->text(), "label"=>"Text"], |
|
153 | + ["data"=>$font->web(), "label"=>"Web"], |
|
154 | + ["data"=>$font->video(), "label"=>"Video"], |
|
155 | + ["data"=>$font->transportation(), "label"=>"Transportation"], |
|
156 | + ["data"=>$font->payment(), "label"=>"Payment"], |
|
157 | + ["data"=>$font->medical(), "label"=>"Medical"], |
|
158 | + ["data"=>$font->hand(), "label"=>"Hand"], |
|
159 | + ["data"=>$font->fileType(), "label"=>"File Type"], |
|
160 | + ["data"=>$font->directional(), "label"=>"Directional"], |
|
161 | + ["data"=>$font->currency(), "label"=>"Currency"], |
|
162 | + ["data"=>$font->chart(), "label"=>"Chart"], |
|
163 | + ["data"=>$font->brands(), "label"=>"Brand"], |
|
164 | + ["data"=>$font->gender(), "label"=>"Gender"], |
|
165 | + ["data"=>$font->form(), "label"=>"Form"], |
|
166 | + ["data"=>$font->spinner(), "label"=>"Spinner"] |
|
167 | 167 | ]; |
168 | 168 | ?> |
169 | 169 | @foreach($fontData as $f) |
@@ -149,21 +149,21 @@ |
||
149 | 149 | <?php |
150 | 150 | $font = new \crocodicstudio\crudbooster\helpers\FontAwesome(); |
151 | 151 | $fontData = [ |
152 | - ["data"=>$font->text(),"label"=>"Text"], |
|
153 | - ["data"=>$font->web(),"label"=>"Web"], |
|
154 | - ["data"=>$font->video(),"label"=>"Video"], |
|
155 | - ["data"=>$font->transportation(),"label"=>"Transportation"], |
|
156 | - ["data"=>$font->payment(),"label"=>"Payment"], |
|
157 | - ["data"=>$font->medical(),"label"=>"Medical"], |
|
158 | - ["data"=>$font->hand(),"label"=>"Hand"], |
|
159 | - ["data"=>$font->fileType(),"label"=>"File Type"], |
|
160 | - ["data"=>$font->directional(),"label"=>"Directional"], |
|
161 | - ["data"=>$font->currency(),"label"=>"Currency"], |
|
162 | - ["data"=>$font->chart(),"label"=>"Chart"], |
|
163 | - ["data"=>$font->brands(),"label"=>"Brand"], |
|
164 | - ["data"=>$font->gender(),"label"=>"Gender"], |
|
165 | - ["data"=>$font->form(),"label"=>"Form"], |
|
166 | - ["data"=>$font->spinner(),"label"=>"Spinner"] |
|
152 | + ["data"=>$font->text(), "label"=>"Text"], |
|
153 | + ["data"=>$font->web(), "label"=>"Web"], |
|
154 | + ["data"=>$font->video(), "label"=>"Video"], |
|
155 | + ["data"=>$font->transportation(), "label"=>"Transportation"], |
|
156 | + ["data"=>$font->payment(), "label"=>"Payment"], |
|
157 | + ["data"=>$font->medical(), "label"=>"Medical"], |
|
158 | + ["data"=>$font->hand(), "label"=>"Hand"], |
|
159 | + ["data"=>$font->fileType(), "label"=>"File Type"], |
|
160 | + ["data"=>$font->directional(), "label"=>"Directional"], |
|
161 | + ["data"=>$font->currency(), "label"=>"Currency"], |
|
162 | + ["data"=>$font->chart(), "label"=>"Chart"], |
|
163 | + ["data"=>$font->brands(), "label"=>"Brand"], |
|
164 | + ["data"=>$font->gender(), "label"=>"Gender"], |
|
165 | + ["data"=>$font->form(), "label"=>"Form"], |
|
166 | + ["data"=>$font->spinner(), "label"=>"Spinner"] |
|
167 | 167 | ]; |
168 | 168 | ?> |
169 | 169 | @foreach($fontData as $f) |
@@ -32,13 +32,13 @@ discard block |
||
32 | 32 | public function handle() |
33 | 33 | { |
34 | 34 | |
35 | - if($this->option("generate")) { |
|
35 | + if ($this->option("generate")) { |
|
36 | 36 | $this->info("== Generating Seeder =="); |
37 | 37 | $this->generateSeeder(); |
38 | 38 | $this->info("== Finish =="); |
39 | - }else{ |
|
39 | + } else { |
|
40 | 40 | $this->info("== Importing the seeder =="); |
41 | - $this->call("db:seed",["--class"=>"CbMigrationSeeder"]); |
|
41 | + $this->call("db:seed", ["--class"=>"CbMigrationSeeder"]); |
|
42 | 42 | $this->info("== Finish =="); |
43 | 43 | } |
44 | 44 | |
@@ -50,18 +50,18 @@ discard block |
||
50 | 50 | $php_string = ""; |
51 | 51 | $additional_tables = cbConfig("ADDITIONAL_DATA_MIGRATION"); |
52 | 52 | |
53 | - foreach($tables as $table) { |
|
54 | - if(substr($table,0,3) == "cb_" || in_array($table, $additional_tables)) { |
|
53 | + foreach ($tables as $table) { |
|
54 | + if (substr($table, 0, 3) == "cb_" || in_array($table, $additional_tables)) { |
|
55 | 55 | $this->info("Create seeder for table : ".$table); |
56 | 56 | $rows = DB::table($table)->get(); |
57 | 57 | $data = []; |
58 | - foreach($rows as $i=>$row) { |
|
58 | + foreach ($rows as $i=>$row) { |
|
59 | 59 | $data[$i] = []; |
60 | - foreach($row as $key=>$val) { |
|
60 | + foreach ($row as $key=>$val) { |
|
61 | 61 | $data[$i][$key] = $val; |
62 | 62 | } |
63 | 63 | } |
64 | - if(count($data)!=0) { |
|
64 | + if (count($data) != 0) { |
|
65 | 65 | $php_string .= 'DB::table(\''.$table.'\')->delete();'."\n\t\t\t"; |
66 | 66 | $php_string .= 'DB::table(\''.$table.'\')->insert('.min_var_export($data).');'."\n\t\t\t"; |
67 | 67 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | $composer_path = ''; |
92 | 92 | if (file_exists(getcwd().'/composer.phar')) { |
93 | 93 | $composer_path = '"'.PHP_BINARY.'" '.getcwd().'/composer.phar'; |
94 | - }else{ |
|
94 | + } else { |
|
95 | 95 | $composer_path = 'composer'; |
96 | 96 | } |
97 | 97 |
@@ -29,11 +29,11 @@ discard block |
||
29 | 29 | $this->setButtonDetail(true); |
30 | 30 | $this->setButtonSave(true); |
31 | 31 | $this->setButtonLimitPage(true); |
32 | - $this->hideButtonDeleteWhen(function ($row) { return false; }); |
|
33 | - $this->hideButtonDetailWhen(function ($row) { return false; }); |
|
34 | - $this->hideButtonEditWhen(function ($row) { return false; }); |
|
35 | - $this->style(function () { return null; }); |
|
36 | - $this->javascript(function () { return null; }); |
|
32 | + $this->hideButtonDeleteWhen(function($row) { return false; }); |
|
33 | + $this->hideButtonDetailWhen(function($row) { return false; }); |
|
34 | + $this->hideButtonEditWhen(function($row) { return false; }); |
|
35 | + $this->style(function() { return null; }); |
|
36 | + $this->javascript(function() { return null; }); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | public function style(callable $style) { |
@@ -137,9 +137,9 @@ discard block |
||
137 | 137 | * @param ButtonColor $color |
138 | 138 | * @param string $attributes |
139 | 139 | */ |
140 | - public function addIndexActionButton($label, $actionURL, $fontAwesome_icon=null, $color=null, $attributes = null) |
|
140 | + public function addIndexActionButton($label, $actionURL, $fontAwesome_icon = null, $color = null, $attributes = null) |
|
141 | 141 | { |
142 | - $color = ($color)?:ButtonColor::DARK_BLUE; |
|
142 | + $color = ($color) ?: ButtonColor::DARK_BLUE; |
|
143 | 143 | |
144 | 144 | $model = new IndexActionButtonModel(); |
145 | 145 | $model->setLabel($label); |
@@ -194,12 +194,12 @@ discard block |
||
194 | 194 | * @param $fontAwesome_icon |
195 | 195 | * @param ButtonColor|string $color |
196 | 196 | */ |
197 | - public function addActionButton($label, $url_target, $condition_callback=null, $fontAwesome_icon=null, $color=null, $confirmation = false) |
|
197 | + public function addActionButton($label, $url_target, $condition_callback = null, $fontAwesome_icon = null, $color = null, $confirmation = false) |
|
198 | 198 | { |
199 | 199 | $new = new AddActionButtonModel(); |
200 | 200 | $new->setLabel($label); |
201 | - $new->setIcon($fontAwesome_icon?:"fa fa-bars"); |
|
202 | - $new->setColor($color?:"primary"); |
|
201 | + $new->setIcon($fontAwesome_icon ?: "fa fa-bars"); |
|
202 | + $new->setColor($color ?: "primary"); |
|
203 | 203 | $new->setUrl($url_target); |
204 | 204 | $new->setCondition($condition_callback); |
205 | 205 | $new->setConfirmation($confirmation); |
@@ -32,12 +32,12 @@ |
||
32 | 32 | { |
33 | 33 | $this->info($this->description); |
34 | 34 | $option = $this->option("module"); |
35 | - if($option == "ALL") { |
|
35 | + if ($option == "ALL") { |
|
36 | 36 | $tables = DB::connection()->getDoctrineSchemaManager()->listTableNames(); |
37 | - foreach($tables as $table) { |
|
37 | + foreach ($tables as $table) { |
|
38 | 38 | $this->generate($table); |
39 | 39 | } |
40 | - }else{ |
|
40 | + } else { |
|
41 | 41 | $this->generate($option); |
42 | 42 | } |
43 | 43 | } |
@@ -35,13 +35,13 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public function optionsFromTable($table, $key_field, $display_field, $SQLCondition = null) { |
37 | 37 | |
38 | - if(strpos($table,"App\Models")!==false) { |
|
38 | + if (strpos($table, "App\Models") !== false) { |
|
39 | 39 | $table = new $table(); |
40 | 40 | $table = $table::$tableName; |
41 | 41 | } |
42 | 42 | |
43 | 43 | $data = DB::table($table); |
44 | - if($SQLCondition && is_callable($SQLCondition)) { |
|
44 | + if ($SQLCondition && is_callable($SQLCondition)) { |
|
45 | 45 | $data = call_user_func($SQLCondition, $data); |
46 | 46 | }elseif ($SQLCondition && is_string($SQLCondition)) { |
47 | 47 | $data->whereRaw($SQLCondition); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | $data = $data->get(); |
50 | 50 | $options = []; |
51 | 51 | foreach ($data as $d) { |
52 | - $options[ $d->$key_field ] = $d->$display_field; |
|
52 | + $options[$d->$key_field] = $d->$display_field; |
|
53 | 53 | } |
54 | 54 | $this->options($options); |
55 | 55 | } |
@@ -40,13 +40,13 @@ discard block |
||
40 | 40 | * @param $SQLCondition string|callable |
41 | 41 | */ |
42 | 42 | public function optionsFromTable($table, $key_field, $display_field, $SQLCondition = null) { |
43 | - if(strpos($table,"App\Models")!==false) { |
|
43 | + if (strpos($table, "App\Models") !== false) { |
|
44 | 44 | $table = new $table(); |
45 | 45 | $table = $table::$tableName; |
46 | 46 | } |
47 | 47 | |
48 | 48 | $data = DB::table($table); |
49 | - if($SQLCondition && is_callable($SQLCondition)) { |
|
49 | + if ($SQLCondition && is_callable($SQLCondition)) { |
|
50 | 50 | $data = call_user_func($SQLCondition, $data); |
51 | 51 | }elseif ($SQLCondition && is_string($SQLCondition)) { |
52 | 52 | $data->whereRaw($SQLCondition); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | $data = $data->get(); |
55 | 55 | $options = []; |
56 | 56 | foreach ($data as $d) { |
57 | - $options[ $d->$key_field ] = $d->$display_field; |
|
57 | + $options[$d->$key_field] = $d->$display_field; |
|
58 | 58 | } |
59 | 59 | $this->options($options); |
60 | 60 | } |
@@ -24,22 +24,22 @@ discard block |
||
24 | 24 | |
25 | 25 | public function getIndex() { |
26 | 26 | $data = []; |
27 | - return view($this->view.".index",$data); |
|
27 | + return view($this->view.".index", $data); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | public function getAdd() { |
31 | 31 | $data = []; |
32 | 32 | $data['form_title'] = "Add Menu"; |
33 | 33 | $data['form_url'] = route('DeveloperMenusControllerPostAddSave'); |
34 | - $data['modules'] = DB::table("cb_modules")->orderBy("name","asc")->get(); |
|
34 | + $data['modules'] = DB::table("cb_modules")->orderBy("name", "asc")->get(); |
|
35 | 35 | return view($this->view.".form", $data); |
36 | 36 | } |
37 | 37 | |
38 | 38 | public function getEdit($id) { |
39 | 39 | $data = []; |
40 | 40 | $data['form_title'] = "Edit Menu"; |
41 | - $data['form_url'] = route('DeveloperMenusControllerPostEditSave',['id'=>$id]); |
|
42 | - $data['modules'] = DB::table("cb_modules")->orderBy("name","asc")->get(); |
|
41 | + $data['form_url'] = route('DeveloperMenusControllerPostEditSave', ['id'=>$id]); |
|
42 | + $data['modules'] = DB::table("cb_modules")->orderBy("name", "asc")->get(); |
|
43 | 43 | $data['row'] = cb()->find("cb_menus", $id); |
44 | 44 | return view($this->view.".form", $data); |
45 | 45 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | $menu['name'] = request('name'); |
53 | 53 | $menu['icon'] = request('icon'); |
54 | 54 | $menu['type'] = request('type'); |
55 | - if(request('type') == 'module') { |
|
55 | + if (request('type') == 'module') { |
|
56 | 56 | $menu['cb_modules_id'] = request('cb_modules_id'); |
57 | 57 | }elseif (request('type') == 'url') { |
58 | 58 | $menu['path'] = request('url_value'); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | |
63 | 63 | DB::table("cb_menus")->insert($menu); |
64 | 64 | |
65 | - return cb()->redirect(route("DeveloperMenusControllerGetIndex"),"The menu has been added!","success"); |
|
65 | + return cb()->redirect(route("DeveloperMenusControllerGetIndex"), "The menu has been added!", "success"); |
|
66 | 66 | |
67 | 67 | } catch (CBValidationException $e) { |
68 | 68 | return cb()->redirectBack($e->getMessage()); |
@@ -77,16 +77,16 @@ discard block |
||
77 | 77 | $menu['name'] = request('name'); |
78 | 78 | $menu['icon'] = request('icon'); |
79 | 79 | $menu['type'] = request('type'); |
80 | - if(request('type') == 'module') { |
|
80 | + if (request('type') == 'module') { |
|
81 | 81 | $menu['cb_modules_id'] = request('cb_modules_id'); |
82 | 82 | }elseif (request('type') == 'url') { |
83 | 83 | $menu['path'] = request('url_value'); |
84 | 84 | }elseif (request('type') == 'path') { |
85 | 85 | $menu['path'] = request('path_value'); |
86 | 86 | } |
87 | - DB::table("cb_menus")->where("id",$id)->update($menu); |
|
87 | + DB::table("cb_menus")->where("id", $id)->update($menu); |
|
88 | 88 | |
89 | - return cb()->redirect(route("DeveloperMenusControllerGetIndex"),"The menu has been saved!","success"); |
|
89 | + return cb()->redirect(route("DeveloperMenusControllerGetIndex"), "The menu has been saved!", "success"); |
|
90 | 90 | |
91 | 91 | } catch (CBValidationException $e) { |
92 | 92 | return cb()->redirectBack($e->getMessage()); |
@@ -99,20 +99,20 @@ discard block |
||
99 | 99 | |
100 | 100 | $menus = request('menus'); |
101 | 101 | $menus = json_decode($menus, true); |
102 | - if($menus) { |
|
102 | + if ($menus) { |
|
103 | 103 | $menus = $menus[0]; |
104 | - if($menus) { |
|
105 | - foreach($menus as $i=>$menu) { |
|
104 | + if ($menus) { |
|
105 | + foreach ($menus as $i=>$menu) { |
|
106 | 106 | $id = $menu['id']; |
107 | - cb()->update("cb_menus",$id,["sort_number"=>$i,'parent_cb_menus_id'=>null]); |
|
108 | - if($menu['children'][0]) { |
|
109 | - foreach($menu['children'][0] as $ii=>$sub) { |
|
107 | + cb()->update("cb_menus", $id, ["sort_number"=>$i, 'parent_cb_menus_id'=>null]); |
|
108 | + if ($menu['children'][0]) { |
|
109 | + foreach ($menu['children'][0] as $ii=>$sub) { |
|
110 | 110 | $id = $sub['id']; |
111 | - cb()->update("cb_menus",$id,["sort_number"=>$ii,"parent_cb_menus_id"=>$menu['id']]); |
|
112 | - if($sub['children'][0]) { |
|
113 | - foreach($sub['children'][0] as $iii=>$subsub) { |
|
111 | + cb()->update("cb_menus", $id, ["sort_number"=>$ii, "parent_cb_menus_id"=>$menu['id']]); |
|
112 | + if ($sub['children'][0]) { |
|
113 | + foreach ($sub['children'][0] as $iii=>$subsub) { |
|
114 | 114 | $id = $subsub['id']; |
115 | - cb()->update("cb_menus",$id,["sort_number"=>$iii,"parent_cb_menus_id"=>$sub['id']]); |
|
115 | + cb()->update("cb_menus", $id, ["sort_number"=>$iii, "parent_cb_menus_id"=>$sub['id']]); |
|
116 | 116 | } |
117 | 117 | } |
118 | 118 | } |
@@ -121,17 +121,17 @@ discard block |
||
121 | 121 | } |
122 | 122 | } |
123 | 123 | |
124 | - return response()->json(['api_status'=>1,'api_message'=>'success']); |
|
124 | + return response()->json(['api_status'=>1, 'api_message'=>'success']); |
|
125 | 125 | |
126 | 126 | } catch (CBValidationException $e) { |
127 | - return response()->json(['api_status'=>0,'api_message'=>$e->getMessage()]); |
|
127 | + return response()->json(['api_status'=>0, 'api_message'=>$e->getMessage()]); |
|
128 | 128 | } |
129 | 129 | } |
130 | 130 | |
131 | 131 | public function getDelete($id) { |
132 | - DB::table("cb_menus")->where("id",$id)->delete(); |
|
132 | + DB::table("cb_menus")->where("id", $id)->delete(); |
|
133 | 133 | |
134 | - return cb()->redirectBack("The menu has been deleted!","success"); |
|
134 | + return cb()->redirectBack("The menu has been deleted!", "success"); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | } |
138 | 138 | \ No newline at end of file |
@@ -26,16 +26,16 @@ discard block |
||
26 | 26 | try { |
27 | 27 | $routeArray = request()->route()->getAction(); |
28 | 28 | $this->controller = class_basename($routeArray['controller']); |
29 | - $this->controller = strtok($this->controller,"@"); |
|
29 | + $this->controller = strtok($this->controller, "@"); |
|
30 | 30 | |
31 | 31 | $className = "\\".$routeArray["namespace"]."\\".$this->controller; |
32 | - if(class_exists($className)) { |
|
33 | - $this->module = cb()->find("cb_modules",["controller"=>$this->controller]); |
|
34 | - if($this->module) { |
|
32 | + if (class_exists($className)) { |
|
33 | + $this->module = cb()->find("cb_modules", ["controller"=>$this->controller]); |
|
34 | + if ($this->module) { |
|
35 | 35 | $this->controller_class = new $className(); |
36 | - $this->menu = cb()->find("cb_menus",["cb_modules_id"=>$this->module->id]); |
|
37 | - $this->menu = (!$this->menu)?cb()->find("cb_menus",["type"=>"path","path"=>request()->segment(2)]):$this->menu; |
|
38 | - if($this->menu) { |
|
36 | + $this->menu = cb()->find("cb_menus", ["cb_modules_id"=>$this->module->id]); |
|
37 | + $this->menu = (!$this->menu) ?cb()->find("cb_menus", ["type"=>"path", "path"=>request()->segment(2)]) : $this->menu; |
|
38 | + if ($this->menu) { |
|
39 | 39 | $this->privilege = DB::table("cb_role_privileges") |
40 | 40 | ->where("cb_menus_id", $this->menu->id) |
41 | 41 | ->where("cb_roles_id", cb()->session()->roleId()) |
@@ -57,9 +57,9 @@ discard block |
||
57 | 57 | } |
58 | 58 | |
59 | 59 | public function getData($key) { |
60 | - if($this->controller_class) { |
|
60 | + if ($this->controller_class) { |
|
61 | 61 | $value = $this->controller_class->getData($key); |
62 | - if(isset($value)) { |
|
62 | + if (isset($value)) { |
|
63 | 63 | return $value; |
64 | 64 | } |
65 | 65 | } |
@@ -70,128 +70,128 @@ discard block |
||
70 | 70 | * @return CBController |
71 | 71 | */ |
72 | 72 | public function getController() { |
73 | - return ($this->controller_class)?$this->controller_class:null; |
|
73 | + return ($this->controller_class) ? $this->controller_class : null; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | public function getPageTitle() |
77 | 77 | { |
78 | - return ($this->controller_class)?$this->controller_class->getData("page_title")?:cb()->getAppName():null; |
|
78 | + return ($this->controller_class) ? $this->controller_class->getData("page_title") ?: cb()->getAppName() : null; |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | public function getTable() |
82 | 82 | { |
83 | - return ($this->controller_class)?$this->controller_class->getData("table"):null; |
|
83 | + return ($this->controller_class) ? $this->controller_class->getData("table") : null; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | public function getPageIcon() |
87 | 87 | { |
88 | - return ($this->controller_class)?$this->controller_class->getData('page_icon')?:"fa fa-bars":null; |
|
88 | + return ($this->controller_class) ? $this->controller_class->getData('page_icon') ?: "fa fa-bars" : null; |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | public function canBrowse() { |
92 | - if($this->privilege) { |
|
93 | - if($this->privilege->can_browse) return true; |
|
92 | + if ($this->privilege) { |
|
93 | + if ($this->privilege->can_browse) return true; |
|
94 | 94 | else return false; |
95 | - }else{ |
|
95 | + } else { |
|
96 | 96 | return true; |
97 | 97 | } |
98 | 98 | } |
99 | 99 | |
100 | 100 | public function canCreate() { |
101 | - if($this->privilege) { |
|
102 | - if($this->privilege->can_create) return true; |
|
101 | + if ($this->privilege) { |
|
102 | + if ($this->privilege->can_create) return true; |
|
103 | 103 | else return false; |
104 | - }else{ |
|
104 | + } else { |
|
105 | 105 | return true; |
106 | 106 | } |
107 | 107 | } |
108 | 108 | |
109 | 109 | public function canRead() { |
110 | - if($this->privilege) { |
|
111 | - if($this->privilege->can_read) return true; |
|
110 | + if ($this->privilege) { |
|
111 | + if ($this->privilege->can_read) return true; |
|
112 | 112 | else return false; |
113 | - }else{ |
|
113 | + } else { |
|
114 | 114 | return true; |
115 | 115 | } |
116 | 116 | } |
117 | 117 | |
118 | 118 | public function canUpdate() { |
119 | - if($this->privilege) { |
|
120 | - if($this->privilege->can_update) return true; |
|
119 | + if ($this->privilege) { |
|
120 | + if ($this->privilege->can_update) return true; |
|
121 | 121 | else return false; |
122 | - }else{ |
|
122 | + } else { |
|
123 | 123 | return true; |
124 | 124 | } |
125 | 125 | } |
126 | 126 | |
127 | 127 | public function canDelete() { |
128 | - if($this->privilege) { |
|
129 | - if($this->privilege->can_delete) return true; |
|
128 | + if ($this->privilege) { |
|
129 | + if ($this->privilege->can_delete) return true; |
|
130 | 130 | else return false; |
131 | - }else{ |
|
131 | + } else { |
|
132 | 132 | return true; |
133 | 133 | } |
134 | 134 | } |
135 | 135 | |
136 | 136 | public function addURL() |
137 | 137 | { |
138 | - if($this->controller_class && method_exists($this->controller_class, 'getAdd')) { |
|
138 | + if ($this->controller_class && method_exists($this->controller_class, 'getAdd')) { |
|
139 | 139 | return action($this->controller.'@getAdd'); |
140 | - }else{ |
|
140 | + } else { |
|
141 | 141 | return null; |
142 | 142 | } |
143 | 143 | } |
144 | 144 | |
145 | 145 | public function addSaveURL() |
146 | 146 | { |
147 | - if($this->controller_class && method_exists($this->controller_class, 'postAddSave')) { |
|
147 | + if ($this->controller_class && method_exists($this->controller_class, 'postAddSave')) { |
|
148 | 148 | return action($this->controller.'@postAddSave'); |
149 | - }else{ |
|
149 | + } else { |
|
150 | 150 | return null; |
151 | 151 | } |
152 | 152 | } |
153 | 153 | |
154 | 154 | public function editURL($id = null) |
155 | 155 | { |
156 | - if($this->controller_class && method_exists($this->controller_class, 'getEdit')) { |
|
157 | - return action($this->controller.'@getEdit',['id'=>$id]); |
|
158 | - }else{ |
|
156 | + if ($this->controller_class && method_exists($this->controller_class, 'getEdit')) { |
|
157 | + return action($this->controller.'@getEdit', ['id'=>$id]); |
|
158 | + } else { |
|
159 | 159 | return null; |
160 | 160 | } |
161 | 161 | } |
162 | 162 | |
163 | 163 | public function editSaveURL($id = null) |
164 | 164 | { |
165 | - if(method_exists($this->controller_class, 'postEditSave')) { |
|
166 | - return action($this->controller.'@postEditSave',['id'=>$id]); |
|
167 | - }else{ |
|
165 | + if (method_exists($this->controller_class, 'postEditSave')) { |
|
166 | + return action($this->controller.'@postEditSave', ['id'=>$id]); |
|
167 | + } else { |
|
168 | 168 | return null; |
169 | 169 | } |
170 | 170 | } |
171 | 171 | |
172 | - public function detailURL($id=null) |
|
172 | + public function detailURL($id = null) |
|
173 | 173 | { |
174 | - if($this->controller_class && method_exists($this->controller_class, 'getDetail')) { |
|
175 | - return action($this->controller.'@getDetail',['id'=>$id]); |
|
176 | - }else{ |
|
174 | + if ($this->controller_class && method_exists($this->controller_class, 'getDetail')) { |
|
175 | + return action($this->controller.'@getDetail', ['id'=>$id]); |
|
176 | + } else { |
|
177 | 177 | return null; |
178 | 178 | } |
179 | 179 | } |
180 | 180 | |
181 | - public function deleteURL($id=null) |
|
181 | + public function deleteURL($id = null) |
|
182 | 182 | { |
183 | - if($this->controller_class && method_exists($this->controller_class, 'getDelete')) { |
|
184 | - return action($this->controller.'@getDelete',['id'=>$id]); |
|
185 | - }else{ |
|
183 | + if ($this->controller_class && method_exists($this->controller_class, 'getDelete')) { |
|
184 | + return action($this->controller.'@getDelete', ['id'=>$id]); |
|
185 | + } else { |
|
186 | 186 | return null; |
187 | 187 | } |
188 | 188 | } |
189 | 189 | |
190 | 190 | public function url($path = null) |
191 | 191 | { |
192 | - if($this->controller_class && method_exists($this->controller_class, 'getIndex')) { |
|
193 | - return trim(action($this->controller.'@getIndex').'/'.$path,'/'); |
|
194 | - }else{ |
|
192 | + if ($this->controller_class && method_exists($this->controller_class, 'getIndex')) { |
|
193 | + return trim(action($this->controller.'@getIndex').'/'.$path, '/'); |
|
194 | + } else { |
|
195 | 195 | return null; |
196 | 196 | } |
197 | 197 | } |