@@ -25,12 +25,12 @@ discard block |
||
| 25 | 25 | public function getIndex() { |
| 26 | 26 | $data = []; |
| 27 | 27 | $data['result'] = DB::table("cb_roles")->get(); |
| 28 | - return view($this->view.".index",$data); |
|
| 28 | + return view($this->view.".index", $data); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | public function getAdd() { |
| 32 | 32 | $data = []; |
| 33 | - $data['menus'] = DB::table("cb_menus")->orderBy("name","asc")->get(); |
|
| 33 | + $data['menus'] = DB::table("cb_menus")->orderBy("name", "asc")->get(); |
|
| 34 | 34 | return view($this->view.".add", $data); |
| 35 | 35 | } |
| 36 | 36 | |
@@ -49,17 +49,17 @@ discard block |
||
| 49 | 49 | $privilege = []; |
| 50 | 50 | $privilege["cb_roles_id"] = $roles_id; |
| 51 | 51 | $privilege["cb_menus_id"] = $menus_id; |
| 52 | - $privilege["can_browse"] = @$access['can_browse']?:0; |
|
| 53 | - $privilege["can_create"] = @$access['can_create']?:0; |
|
| 54 | - $privilege["can_read"] = @$access['can_read']?:0; |
|
| 55 | - $privilege["can_update"] = @$access['can_update']?:0; |
|
| 56 | - $privilege["can_delete"] = @$access['can_delete']?:0; |
|
| 52 | + $privilege["can_browse"] = @$access['can_browse'] ?: 0; |
|
| 53 | + $privilege["can_create"] = @$access['can_create'] ?: 0; |
|
| 54 | + $privilege["can_read"] = @$access['can_read'] ?: 0; |
|
| 55 | + $privilege["can_update"] = @$access['can_update'] ?: 0; |
|
| 56 | + $privilege["can_delete"] = @$access['can_delete'] ?: 0; |
|
| 57 | 57 | DB::table("cb_role_privileges")->insert($privilege); |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | DB::commit(); |
| 61 | 61 | |
| 62 | - return cb()->redirect(route("DeveloperRolesControllerGetIndex"),"The role has been saved!","success"); |
|
| 62 | + return cb()->redirect(route("DeveloperRolesControllerGetIndex"), "The role has been saved!", "success"); |
|
| 63 | 63 | |
| 64 | 64 | } catch (CBValidationException $e) { |
| 65 | 65 | return cb()->redirectBack($e->getMessage()); |
@@ -74,21 +74,21 @@ discard block |
||
| 74 | 74 | $data['row'] = cb()->find("cb_roles", $id); |
| 75 | 75 | |
| 76 | 76 | $menus = DB::table("cb_menus") |
| 77 | - ->leftjoin("cb_role_privileges",function($join) use ($id) { |
|
| 78 | - $join->on("cb_role_privileges.cb_menus_id","=","cb_menus.id")->where("cb_role_privileges.cb_roles_id", $id); |
|
| 77 | + ->leftjoin("cb_role_privileges", function($join) use ($id) { |
|
| 78 | + $join->on("cb_role_privileges.cb_menus_id", "=", "cb_menus.id")->where("cb_role_privileges.cb_roles_id", $id); |
|
| 79 | 79 | }) |
| 80 | - ->orderBy("cb_menus.name","asc") |
|
| 81 | - ->select("cb_menus.*","can_browse","can_create","can_read","can_update","can_delete") |
|
| 80 | + ->orderBy("cb_menus.name", "asc") |
|
| 81 | + ->select("cb_menus.*", "can_browse", "can_create", "can_read", "can_update", "can_delete") |
|
| 82 | 82 | ->get(); |
| 83 | 83 | $data['menus'] = $menus; |
| 84 | 84 | |
| 85 | - return view($this->view.".edit",$data); |
|
| 85 | + return view($this->view.".edit", $data); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | private function existsPrivilege($cb_roles_id, $cb_menus_id) { |
| 89 | - if($row = cb()->find("cb_role_privileges",['cb_roles_id'=>$cb_roles_id,'cb_menus_id'=>$cb_menus_id])) { |
|
| 89 | + if ($row = cb()->find("cb_role_privileges", ['cb_roles_id'=>$cb_roles_id, 'cb_menus_id'=>$cb_menus_id])) { |
|
| 90 | 90 | return $row->id; |
| 91 | - }else{ |
|
| 91 | + } else { |
|
| 92 | 92 | return null; |
| 93 | 93 | } |
| 94 | 94 | } |
@@ -97,26 +97,26 @@ discard block |
||
| 97 | 97 | try { |
| 98 | 98 | cb()->validation(['name', 'menus']); |
| 99 | 99 | |
| 100 | - cb()->updateCompact("cb_roles",$id,['name']); |
|
| 100 | + cb()->updateCompact("cb_roles", $id, ['name']); |
|
| 101 | 101 | |
| 102 | 102 | foreach (request("menus") as $menus_id) { |
| 103 | 103 | @$access = request("access")[$menus_id]; |
| 104 | 104 | $privilege = []; |
| 105 | 105 | $privilege["cb_roles_id"] = $id; |
| 106 | 106 | $privilege["cb_menus_id"] = $menus_id; |
| 107 | - $privilege["can_browse"] = @$access['can_browse']?:0; |
|
| 108 | - $privilege["can_create"] = @$access['can_create']?:0; |
|
| 109 | - $privilege["can_read"] = @$access['can_read']?:0; |
|
| 110 | - $privilege["can_update"] = @$access['can_update']?:0; |
|
| 111 | - $privilege["can_delete"] = @$access['can_delete']?:0; |
|
| 112 | - if($privilege_id = $this->existsPrivilege($id, $menus_id)) { |
|
| 107 | + $privilege["can_browse"] = @$access['can_browse'] ?: 0; |
|
| 108 | + $privilege["can_create"] = @$access['can_create'] ?: 0; |
|
| 109 | + $privilege["can_read"] = @$access['can_read'] ?: 0; |
|
| 110 | + $privilege["can_update"] = @$access['can_update'] ?: 0; |
|
| 111 | + $privilege["can_delete"] = @$access['can_delete'] ?: 0; |
|
| 112 | + if ($privilege_id = $this->existsPrivilege($id, $menus_id)) { |
|
| 113 | 113 | DB::table("cb_role_privileges")->where("id", $privilege_id)->update($privilege); |
| 114 | - }else{ |
|
| 114 | + } else { |
|
| 115 | 115 | DB::table("cb_role_privileges")->insert($privilege); |
| 116 | 116 | } |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - return cb()->redirect(route("DeveloperRolesControllerGetIndex"),"The role has been saved!","success"); |
|
| 119 | + return cb()->redirect(route("DeveloperRolesControllerGetIndex"), "The role has been saved!", "success"); |
|
| 120 | 120 | |
| 121 | 121 | } catch (CBValidationException $e) { |
| 122 | 122 | |
@@ -126,9 +126,9 @@ discard block |
||
| 126 | 126 | |
| 127 | 127 | public function getDelete($id) { |
| 128 | 128 | DB::table("cb_roles")->where("id", $id)->delete(); |
| 129 | - DB::table("cb_role_privileges")->where("cb_roles_id",$id)->delete(); |
|
| 129 | + DB::table("cb_role_privileges")->where("cb_roles_id", $id)->delete(); |
|
| 130 | 130 | |
| 131 | - return cb()->redirect(route("DeveloperRolesControllerGetIndex"), "The role has been deleted!","success"); |
|
| 131 | + return cb()->redirect(route("DeveloperRolesControllerGetIndex"), "The role has been deleted!", "success"); |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | } |
| 135 | 135 | \ No newline at end of file |
@@ -21,10 +21,10 @@ |
||
| 21 | 21 | public function options($data_options) { |
| 22 | 22 | $data = columnSingleton()->getColumn($this->index); |
| 23 | 23 | |
| 24 | - foreach($data_options as $key=>$option) { |
|
| 25 | - if(is_int($key)) { |
|
| 24 | + foreach ($data_options as $key=>$option) { |
|
| 25 | + if (is_int($key)) { |
|
| 26 | 26 | $data_options[$option] = $option; |
| 27 | - }else{ |
|
| 27 | + } else { |
|
| 28 | 28 | $data_options[$key] = $option; |
| 29 | 29 | } |
| 30 | 30 | } |
@@ -7,7 +7,7 @@ |
||
| 7 | 7 | name="{{ $column->getName() }}" id="{{ $column->getName() }}"> |
| 8 | 8 | <option value="">** Select a {{ $column->getLabel() }}</option> |
| 9 | 9 | <?php |
| 10 | - $columnValue = old($column->getName())?:($column->getDefaultValue())?:$column->getValue(); |
|
| 10 | + $columnValue = old($column->getName()) ?: ($column->getDefaultValue()) ?: $column->getValue(); |
|
| 11 | 11 | ?> |
| 12 | 12 | @foreach($column->getOptions() as $key=>$value) |
| 13 | 13 | <option {{ $columnValue==$key?'selected':'' }} value="{{ $key }}">{{ $value }}</option> |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | { |
| 22 | 22 | $option = $column->getOptions(); |
| 23 | 23 | $key = $row->{ $column->getField() }; |
| 24 | - return @$option[ $key ]; |
|
| 24 | + return @$option[$key]; |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | public function detailRender($row, $column) |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -cb()->routeGroupBackend(function () { |
|
| 4 | - cb()->routePost("select-table-lookup",'\crocodicstudio\crudbooster\types\select_table\SelectTableController@postLookup'); |
|
| 3 | +cb()->routeGroupBackend(function() { |
|
| 4 | + cb()->routePost("select-table-lookup", '\crocodicstudio\crudbooster\types\select_table\SelectTableController@postLookup'); |
|
| 5 | 5 | }); |
| 6 | 6 | \ No newline at end of file |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | <option value="">** Select a {{ $column->getLabel() }}</option> |
| 9 | 9 | @if(!$column->getForeignKey()) |
| 10 | 10 | <?php |
| 11 | - $columnValue = old($column->getName())?:($column->getDefaultValue())?:$column->getValue(); |
|
| 11 | + $columnValue = old($column->getName()) ?: ($column->getDefaultValue()) ?: $column->getValue(); |
|
| 12 | 12 | ?> |
| 13 | 13 | @foreach($column->getOptions() as $key=>$value) |
| 14 | 14 | <option {{ $columnValue==$key?'selected':'' }} value="{{ $key }}">{{ $value }}</option> |
@@ -18,11 +18,11 @@ discard block |
||
| 18 | 18 | $foreignValue = request('foreign_value'); |
| 19 | 19 | $table = decrypt(request('table')); |
| 20 | 20 | $sqlCondition = decrypt(request('sql_condition')); |
| 21 | - if($foreignKey && $foreignValue && $table) { |
|
| 21 | + if ($foreignKey && $foreignValue && $table) { |
|
| 22 | 22 | |
| 23 | 23 | $data = DB::table($table) |
| 24 | 24 | ->where($foreignKey, $foreignValue); |
| 25 | - if($sqlCondition) { |
|
| 25 | + if ($sqlCondition) { |
|
| 26 | 26 | $data->whereRaw($sqlCondition); |
| 27 | 27 | } |
| 28 | 28 | |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | return response()->json(['status'=>true, 'data'=>$data], 200, ["X-Frame-Options"=>"SAMEORIGIN"]); |
| 32 | 32 | |
| 33 | - }else{ |
|
| 33 | + } else { |
|
| 34 | 34 | return response()->json(['status'=>false]); |
| 35 | 35 | } |
| 36 | 36 | } |
@@ -18,8 +18,8 @@ |
||
| 18 | 18 | public function handle($request, Closure $next) |
| 19 | 19 | { |
| 20 | 20 | |
| 21 | - if(session()->get("developer") != getSetting('developer_username')) { |
|
| 22 | - return cb()->redirect(cb()->getDeveloperUrl("login"),"Please login for first"); |
|
| 21 | + if (session()->get("developer") != getSetting('developer_username')) { |
|
| 22 | + return cb()->redirect(cb()->getDeveloperUrl("login"), "Please login for first"); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | return $next($request); |
@@ -25,15 +25,15 @@ |
||
| 25 | 25 | { |
| 26 | 26 | |
| 27 | 27 | try { |
| 28 | - if(@$this->command->option("password") == "AUTO" || !@$this->command->option("password")) { |
|
| 28 | + if (@$this->command->option("password") == "AUTO" || !@$this->command->option("password")) { |
|
| 29 | 29 | $password = Str::random(16); |
| 30 | - }else{ |
|
| 30 | + } else { |
|
| 31 | 31 | $password = $this->command->option("password"); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - if(@$this->command->option("username") == "AUTO" || !@$this->command->option("username")) { |
|
| 34 | + if (@$this->command->option("username") == "AUTO" || !@$this->command->option("username")) { |
|
| 35 | 35 | $username = Str::random(5); |
| 36 | - }else{ |
|
| 36 | + } else { |
|
| 37 | 37 | $username = $this->command->option("username"); |
| 38 | 38 | } |
| 39 | 39 | } catch (\Exception $e) { |