@@ -1,30 +1,30 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | // Developer Backend Middleware |
| 4 | -Route::group(['middleware' => ['web',\crocodicstudio\crudbooster\middlewares\CBDeveloper::class], |
|
| 4 | +Route::group(['middleware' => ['web', \crocodicstudio\crudbooster\middlewares\CBDeveloper::class], |
|
| 5 | 5 | 'prefix'=>cbConfig('DEV_PATH'), |
| 6 | - 'namespace' => 'crocodicstudio\crudbooster\controllers'], function () { |
|
| 6 | + 'namespace' => 'crocodicstudio\crudbooster\controllers'], function() { |
|
| 7 | 7 | cb()->routeController("modules", "DeveloperModulesController"); |
| 8 | 8 | cb()->routeController("menus", "DeveloperMenusController"); |
| 9 | - cb()->routeController("roles","DeveloperRolesController"); |
|
| 9 | + cb()->routeController("roles", "DeveloperRolesController"); |
|
| 10 | 10 | }); |
| 11 | 11 | |
| 12 | 12 | // Developer Auth Middleware |
| 13 | 13 | Route::group(['middleware' => ['web'], |
| 14 | 14 | 'prefix'=>cbConfig('DEV_PATH'), |
| 15 | - 'namespace' => 'crocodicstudio\crudbooster\controllers'], function () { |
|
| 16 | - Route::post("login","AdminAuthController@postLoginDeveloper"); |
|
| 17 | - Route::get("login","AdminAuthController@getLoginDeveloper"); |
|
| 18 | - Route::get("logout","AdminAuthController@getLogoutDeveloper"); |
|
| 15 | + 'namespace' => 'crocodicstudio\crudbooster\controllers'], function() { |
|
| 16 | + Route::post("login", "AdminAuthController@postLoginDeveloper"); |
|
| 17 | + Route::get("login", "AdminAuthController@getLoginDeveloper"); |
|
| 18 | + Route::get("logout", "AdminAuthController@getLogoutDeveloper"); |
|
| 19 | 19 | }); |
| 20 | 20 | |
| 21 | 21 | // Routing without any middleware |
| 22 | -Route::group(['middleware' => ['web'], 'namespace' => '\crocodicstudio\crudbooster\controllers'], function () { |
|
| 22 | +Route::group(['middleware' => ['web'], 'namespace' => '\crocodicstudio\crudbooster\controllers'], function() { |
|
| 23 | 23 | Route::get('uploads/{one?}/{two?}/{three?}/{four?}/{five?}', ['uses' => 'FileController@getPreview', 'as' => 'fileControllerPreview']); |
| 24 | 24 | }); |
| 25 | 25 | |
| 26 | 26 | // Routing without any middleware with admin prefix |
| 27 | -Route::group(['middleware' => ['web'], 'prefix' => cbConfig('ADMIN_PATH'), 'namespace' => 'crocodicstudio\crudbooster\controllers'], function () { |
|
| 27 | +Route::group(['middleware' => ['web'], 'prefix' => cbConfig('ADMIN_PATH'), 'namespace' => 'crocodicstudio\crudbooster\controllers'], function() { |
|
| 28 | 28 | Route::get('logout', ['uses' => 'AdminAuthController@getLogout', 'as' => 'getLogout']); |
| 29 | 29 | Route::post('login', ['uses' => 'AdminAuthController@postLogin', 'as' => 'postLogin']); |
| 30 | 30 | Route::get('login', ['uses' => 'AdminAuthController@getLogin', 'as' => 'getLogin']); |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | 'middleware' => ['web', \crocodicstudio\crudbooster\middlewares\CBBackend::class], |
| 36 | 36 | 'prefix' => cbConfig('ADMIN_PATH'), |
| 37 | 37 | 'namespace' => 'crocodicstudio\crudbooster\controllers', |
| 38 | -], function () { |
|
| 38 | +], function() { |
|
| 39 | 39 | cb()->routeController('profile', 'AdminProfileController'); |
| 40 | 40 | }); |
| 41 | 41 | |
@@ -44,21 +44,21 @@ discard block |
||
| 44 | 44 | 'middleware' => ['web', \crocodicstudio\crudbooster\middlewares\CBBackend::class], |
| 45 | 45 | 'prefix' => cbConfig('ADMIN_PATH'), |
| 46 | 46 | 'namespace' => 'App\Http\Controllers', |
| 47 | -], function () { |
|
| 47 | +], function() { |
|
| 48 | 48 | |
| 49 | 49 | if (Request::is(cbConfig('ADMIN_PATH'))) { |
| 50 | - if($dashboard = cbConfig("ADMIN_DASHBOARD_CONTROLLER")) { |
|
| 50 | + if ($dashboard = cbConfig("ADMIN_DASHBOARD_CONTROLLER")) { |
|
| 51 | 51 | Route::get("/", $dashboard); |
| 52 | - }else{ |
|
| 52 | + } else { |
|
| 53 | 53 | Route::get("/", "crocodicstudio\crudbooster\controllers\AdminDashboardController@getIndex"); |
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | $controllers = glob(app_path('Http/Controllers/*.php')); |
| 58 | - foreach($controllers as $controller) { |
|
| 58 | + foreach ($controllers as $controller) { |
|
| 59 | 59 | $controllerName = basename($controller); |
| 60 | 60 | $controllerClass = new ('\App\Http\Controllers\\'.$controllerName)(); |
| 61 | - if(method_exists($controllerClass, 'cbInit')) { |
|
| 61 | + if (method_exists($controllerClass, 'cbInit')) { |
|
| 62 | 62 | cb()->routeController($controllerClass->getData('permalink'), $controllerName); |
| 63 | 63 | } |
| 64 | 64 | } |
@@ -30,9 +30,9 @@ |
||
| 30 | 30 | /* |
| 31 | 31 | * For security reason we have limit the upload file formats bellow |
| 32 | 32 | */ |
| 33 | - 'UPLOAD_FILE_EXTENSION_ALLOWED' => ['jpg','jpeg','png','gif','pdf','xls','xlsx','doc','docx','txt','zip','rar','rtf'], |
|
| 33 | + 'UPLOAD_FILE_EXTENSION_ALLOWED' => ['jpg', 'jpeg', 'png', 'gif', 'pdf', 'xls', 'xlsx', 'doc', 'docx', 'txt', 'zip', 'rar', 'rtf'], |
|
| 34 | 34 | |
| 35 | - 'UPLOAD_IMAGE_EXTENSION_ALLOWED' => ['jpg','jpeg','png','gif'], |
|
| 35 | + 'UPLOAD_IMAGE_EXTENSION_ALLOWED' => ['jpg', 'jpeg', 'png', 'gif'], |
|
| 36 | 36 | |
| 37 | 37 | /* |
| 38 | 38 | * Google FCM Server Key is used to send a notification via FireBase cloud message |
@@ -84,9 +84,9 @@ discard block |
||
| 84 | 84 | * @param ButtonColor $color |
| 85 | 85 | * @param string $attributes |
| 86 | 86 | */ |
| 87 | - public function addIndexActionButton($label, $actionURL, $fontAwesome_icon=null, $color=null, $attributes = null) |
|
| 87 | + public function addIndexActionButton($label, $actionURL, $fontAwesome_icon = null, $color = null, $attributes = null) |
|
| 88 | 88 | { |
| 89 | - $color = ($color)?:ButtonColor::DARK_BLUE; |
|
| 89 | + $color = ($color) ?: ButtonColor::DARK_BLUE; |
|
| 90 | 90 | |
| 91 | 91 | $model = new IndexActionButtonModel(); |
| 92 | 92 | $model->setLabel($label); |
@@ -128,12 +128,12 @@ discard block |
||
| 128 | 128 | * @param $fontAwesome_icon |
| 129 | 129 | * @param ButtonColor|string $color |
| 130 | 130 | */ |
| 131 | - public function addActionButton($label, $url_target, $condition_callback=null, $fontAwesome_icon=null, $color=null, $confirmation = false) |
|
| 131 | + public function addActionButton($label, $url_target, $condition_callback = null, $fontAwesome_icon = null, $color = null, $confirmation = false) |
|
| 132 | 132 | { |
| 133 | 133 | $new = new AddActionButtonModel(); |
| 134 | 134 | $new->setLabel($label); |
| 135 | - $new->setIcon($fontAwesome_icon?:"fa fa-bars"); |
|
| 136 | - $new->setColor($color?:"primary"); |
|
| 135 | + $new->setIcon($fontAwesome_icon ?: "fa fa-bars"); |
|
| 136 | + $new->setColor($color ?: "primary"); |
|
| 137 | 137 | $new->setUrl($url_target); |
| 138 | 138 | $new->setCondition($condition_callback); |
| 139 | 139 | $new->setConfirmation($confirmation); |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | $fullStoragePath = storage_path('app/'.$fullFilePath); |
| 35 | 35 | $lifetime = 31556926; // One year in seconds |
| 36 | 36 | |
| 37 | - if (! Storage::exists($fullFilePath)) { |
|
| 37 | + if (!Storage::exists($fullFilePath)) { |
|
| 38 | 38 | abort(404); |
| 39 | 39 | } |
| 40 | 40 | |
@@ -55,10 +55,10 @@ discard block |
||
| 55 | 55 | $h = Request::get('h') ?: $w; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - $imgRaw = Image::cache(function ($image) use ($fullStoragePath, $w, $h) { |
|
| 58 | + $imgRaw = Image::cache(function($image) use ($fullStoragePath, $w, $h) { |
|
| 59 | 59 | $im = $image->make($fullStoragePath); |
| 60 | 60 | if ($w) { |
| 61 | - if (! $h) { |
|
| 61 | + if (!$h) { |
|
| 62 | 62 | $im->fit($w); |
| 63 | 63 | } else { |
| 64 | 64 | $im->fit($w, $h); |
@@ -19,22 +19,22 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | public function getIndex() { |
| 21 | 21 | $data = []; |
| 22 | - return view($this->view.".index",$data); |
|
| 22 | + return view($this->view.".index", $data); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | public function getAdd() { |
| 26 | 26 | $data = []; |
| 27 | 27 | $data['form_title'] = "Add Menu"; |
| 28 | 28 | $data['form_url'] = action('DeveloperMenusController@postAddSave'); |
| 29 | - $data['modules'] = DB::table("cb_modules")->orderBy("name","asc")->get(); |
|
| 29 | + $data['modules'] = DB::table("cb_modules")->orderBy("name", "asc")->get(); |
|
| 30 | 30 | return view($this->view.".form", $data); |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | public function getEdit($id) { |
| 34 | 34 | $data = []; |
| 35 | 35 | $data['form_title'] = "Edit Menu"; |
| 36 | - $data['form_url'] = action('DeveloperMenusController@postEditSave',['id'=>$id]); |
|
| 37 | - $data['modules'] = DB::table("cb_modules")->orderBy("name","asc")->get(); |
|
| 36 | + $data['form_url'] = action('DeveloperMenusController@postEditSave', ['id'=>$id]); |
|
| 37 | + $data['modules'] = DB::table("cb_modules")->orderBy("name", "asc")->get(); |
|
| 38 | 38 | $data['row'] = cb()->find("cb_menus", $id); |
| 39 | 39 | return view($this->view.".form", $data); |
| 40 | 40 | } |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | $menu['cb_modules_id'] = request('cb_modules_id'); |
| 51 | 51 | DB::table("cb_menus")->insert($menu); |
| 52 | 52 | |
| 53 | - return cb()->redirect(action("DeveloperMenusController@getIndex"),"The menu has been added!","success"); |
|
| 53 | + return cb()->redirect(action("DeveloperMenusController@getIndex"), "The menu has been added!", "success"); |
|
| 54 | 54 | |
| 55 | 55 | } catch (CBValidationException $e) { |
| 56 | 56 | return cb()->redirectBack($e->getMessage()); |
@@ -66,9 +66,9 @@ discard block |
||
| 66 | 66 | $menu['icon'] = request('icon'); |
| 67 | 67 | $menu['type'] = request('type'); |
| 68 | 68 | $menu['cb_modules_id'] = request('cb_modules_id'); |
| 69 | - DB::table("cb_menus")->where("id",$id)->update($menu); |
|
| 69 | + DB::table("cb_menus")->where("id", $id)->update($menu); |
|
| 70 | 70 | |
| 71 | - return cb()->redirect(action("DeveloperMenusController@getIndex"),"The menu has been saved!","success"); |
|
| 71 | + return cb()->redirect(action("DeveloperMenusController@getIndex"), "The menu has been saved!", "success"); |
|
| 72 | 72 | |
| 73 | 73 | } catch (CBValidationException $e) { |
| 74 | 74 | return cb()->redirectBack($e->getMessage()); |
@@ -81,20 +81,20 @@ discard block |
||
| 81 | 81 | |
| 82 | 82 | $menus = request('menus'); |
| 83 | 83 | $menus = json_decode($menus, true); |
| 84 | - if($menus) { |
|
| 84 | + if ($menus) { |
|
| 85 | 85 | $menus = $menus[0]; |
| 86 | - if($menus) { |
|
| 87 | - foreach($menus as $i=>$menu) { |
|
| 86 | + if ($menus) { |
|
| 87 | + foreach ($menus as $i=>$menu) { |
|
| 88 | 88 | $id = $menu['id']; |
| 89 | - cb()->update("cb_menus",$id,["sort_number"=>$i]); |
|
| 90 | - if($menu['children'][0]) { |
|
| 91 | - foreach($menu['children'][0] as $ii=>$sub) { |
|
| 89 | + cb()->update("cb_menus", $id, ["sort_number"=>$i]); |
|
| 90 | + if ($menu['children'][0]) { |
|
| 91 | + foreach ($menu['children'][0] as $ii=>$sub) { |
|
| 92 | 92 | $id = $sub['id']; |
| 93 | - cb()->update("cb_menus",$id,["sort_number"=>$ii]); |
|
| 94 | - if($sub['children'][0]) { |
|
| 95 | - foreach($sub['children'][0] as $iii=>$subsub) { |
|
| 93 | + cb()->update("cb_menus", $id, ["sort_number"=>$ii]); |
|
| 94 | + if ($sub['children'][0]) { |
|
| 95 | + foreach ($sub['children'][0] as $iii=>$subsub) { |
|
| 96 | 96 | $id = $subsub['id']; |
| 97 | - cb()->update("cb_menus",$id,["sort_number"=>$iii]); |
|
| 97 | + cb()->update("cb_menus", $id, ["sort_number"=>$iii]); |
|
| 98 | 98 | } |
| 99 | 99 | } |
| 100 | 100 | } |
@@ -103,10 +103,10 @@ discard block |
||
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - return response()->json(['api_status'=>1,'api_message'=>'success']); |
|
| 106 | + return response()->json(['api_status'=>1, 'api_message'=>'success']); |
|
| 107 | 107 | |
| 108 | 108 | } catch (CBValidationException $e) { |
| 109 | - return response()->json(['api_status'=>0,'api_message'=>$e->getMessage()]); |
|
| 109 | + return response()->json(['api_status'=>0, 'api_message'=>$e->getMessage()]); |
|
| 110 | 110 | } |
| 111 | 111 | } |
| 112 | 112 | |
@@ -20,12 +20,12 @@ discard block |
||
| 20 | 20 | public function getIndex() { |
| 21 | 21 | $data = []; |
| 22 | 22 | $data['result'] = DB::table("cb_roles")->get(); |
| 23 | - return view($this->view.".index",$data); |
|
| 23 | + return view($this->view.".index", $data); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | public function getAdd() { |
| 27 | 27 | $data = []; |
| 28 | - $data['menus'] = DB::table("cb_menus")->orderBy("name","asc")->get(); |
|
| 28 | + $data['menus'] = DB::table("cb_menus")->orderBy("name", "asc")->get(); |
|
| 29 | 29 | return view($this->view.".add", $data); |
| 30 | 30 | } |
| 31 | 31 | |
@@ -43,11 +43,11 @@ discard block |
||
| 43 | 43 | $privilege = []; |
| 44 | 44 | $privilege["cb_roles_id"] = $roles_id; |
| 45 | 45 | $privilege["cb_menus_id"] = $menus_id; |
| 46 | - $privilege["can_browse"] = $menu['can_browse']?:0; |
|
| 47 | - $privilege["can_create"] = $menu['can_create']?:0; |
|
| 48 | - $privilege["can_read"] = $menu['can_read']?:0; |
|
| 49 | - $privilege["can_update"] = $menu['can_update']?:0; |
|
| 50 | - $privilege["can_delete"] = $menu['can_delete']?:0; |
|
| 46 | + $privilege["can_browse"] = $menu['can_browse'] ?: 0; |
|
| 47 | + $privilege["can_create"] = $menu['can_create'] ?: 0; |
|
| 48 | + $privilege["can_read"] = $menu['can_read'] ?: 0; |
|
| 49 | + $privilege["can_update"] = $menu['can_update'] ?: 0; |
|
| 50 | + $privilege["can_delete"] = $menu['can_delete'] ?: 0; |
|
| 51 | 51 | DB::table("cb_role_privileges")->insert($privilege); |
| 52 | 52 | } |
| 53 | 53 | |
@@ -66,21 +66,21 @@ discard block |
||
| 66 | 66 | $data['row'] = cb()->find("cb_roles", $id); |
| 67 | 67 | |
| 68 | 68 | $menus = DB::table("cb_menus") |
| 69 | - ->leftjoin("cb_role_privileges",function($join) use ($id) { |
|
| 70 | - $join->on("cb_role_privileges.cb_menus_id","=","cb_menus.id")->where("cb_role_privileges.cb_roles_id", $id); |
|
| 69 | + ->leftjoin("cb_role_privileges", function($join) use ($id) { |
|
| 70 | + $join->on("cb_role_privileges.cb_menus_id", "=", "cb_menus.id")->where("cb_role_privileges.cb_roles_id", $id); |
|
| 71 | 71 | }) |
| 72 | - ->orderBy("cb_menus.name","asc") |
|
| 73 | - ->select("cb_menus.*","can_browse","can_create","can_read","can_update","can_delete") |
|
| 72 | + ->orderBy("cb_menus.name", "asc") |
|
| 73 | + ->select("cb_menus.*", "can_browse", "can_create", "can_read", "can_update", "can_delete") |
|
| 74 | 74 | ->get(); |
| 75 | 75 | $data['menus'] = $menus; |
| 76 | 76 | |
| 77 | - return view($this->view.".edit",$data); |
|
| 77 | + return view($this->view.".edit", $data); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | private function existsPrivilege($cb_roles_id, $cb_menus_id) { |
| 81 | - if($row = cb()->find("cb_role_privileges",['cb_roles_id'=>$cb_roles_id,'cb_menus_id'=>$cb_menus_id])) { |
|
| 81 | + if ($row = cb()->find("cb_role_privileges", ['cb_roles_id'=>$cb_roles_id, 'cb_menus_id'=>$cb_menus_id])) { |
|
| 82 | 82 | return $row->id; |
| 83 | - }else{ |
|
| 83 | + } else { |
|
| 84 | 84 | return null; |
| 85 | 85 | } |
| 86 | 86 | } |
@@ -89,25 +89,25 @@ discard block |
||
| 89 | 89 | try { |
| 90 | 90 | cb()->validation(['name', 'menus']); |
| 91 | 91 | |
| 92 | - cb()->updateCompact("cb_roles",$id,['name']); |
|
| 92 | + cb()->updateCompact("cb_roles", $id, ['name']); |
|
| 93 | 93 | |
| 94 | 94 | foreach (request("menus") as $menus_id => $menu) { |
| 95 | 95 | $privilege = []; |
| 96 | 96 | $privilege["cb_roles_id"] = $id; |
| 97 | 97 | $privilege["cb_menus_id"] = $menus_id; |
| 98 | - $privilege["can_browse"] = $menu['can_browse']?:0; |
|
| 99 | - $privilege["can_create"] = $menu['can_create']?:0; |
|
| 100 | - $privilege["can_read"] = $menu['can_read']?:0; |
|
| 101 | - $privilege["can_update"] = $menu['can_update']?:0; |
|
| 102 | - $privilege["can_delete"] = $menu['can_delete']?:0; |
|
| 103 | - if($privilege_id = $this->existsPrivilege($id, $menus_id)) { |
|
| 98 | + $privilege["can_browse"] = $menu['can_browse'] ?: 0; |
|
| 99 | + $privilege["can_create"] = $menu['can_create'] ?: 0; |
|
| 100 | + $privilege["can_read"] = $menu['can_read'] ?: 0; |
|
| 101 | + $privilege["can_update"] = $menu['can_update'] ?: 0; |
|
| 102 | + $privilege["can_delete"] = $menu['can_delete'] ?: 0; |
|
| 103 | + if ($privilege_id = $this->existsPrivilege($id, $menus_id)) { |
|
| 104 | 104 | DB::table("cb_role_privileges")->where("id", $privilege_id)->update($privilege); |
| 105 | - }else{ |
|
| 105 | + } else { |
|
| 106 | 106 | DB::table("cb_role_privileges")->insert($privilege); |
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - return cb()->redirect(action("DeveloperRolesController@getIndex"),"The role has been saved!","success"); |
|
| 110 | + return cb()->redirect(action("DeveloperRolesController@getIndex"), "The role has been saved!", "success"); |
|
| 111 | 111 | |
| 112 | 112 | } catch (CBValidationException $e) { |
| 113 | 113 | |
@@ -117,9 +117,9 @@ discard block |
||
| 117 | 117 | |
| 118 | 118 | public function getDelete($id) { |
| 119 | 119 | DB::table("cb_roles")->where("id", $id)->delete(); |
| 120 | - DB::table("cb_role_privileges")->where("cb_roles_id",$id)->delete(); |
|
| 120 | + DB::table("cb_role_privileges")->where("cb_roles_id", $id)->delete(); |
|
| 121 | 121 | |
| 122 | - return cb()->redirectBack("The role has been deleted!","success"); |
|
| 122 | + return cb()->redirectBack("The role has been deleted!", "success"); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | } |
| 126 | 126 | \ No newline at end of file |
@@ -32,8 +32,8 @@ discard block |
||
| 32 | 32 | $data = new ColumnModel(); |
| 33 | 33 | $data = $this->setDefaultModelValue($data); |
| 34 | 34 | $data->setLabel($label); |
| 35 | - $data->setName($this->name($label,$name)); |
|
| 36 | - $data->setField($field_to_save?:$this->name($label, $name)); |
|
| 35 | + $data->setName($this->name($label, $name)); |
|
| 36 | + $data->setField($field_to_save ?: $this->name($label, $name)); |
|
| 37 | 37 | $data->setType("text"); |
| 38 | 38 | |
| 39 | 39 | columnSingleton()->setColumn($this->index, $data); |
@@ -48,8 +48,8 @@ discard block |
||
| 48 | 48 | $data = new CheckboxModel(); |
| 49 | 49 | $data = $this->setDefaultModelValue($data); |
| 50 | 50 | $data->setLabel($label); |
| 51 | - $data->setName($this->name($label,$name)); |
|
| 52 | - $data->setField($field_to_save?:$this->name($label, $name)); |
|
| 51 | + $data->setName($this->name($label, $name)); |
|
| 52 | + $data->setField($field_to_save ?: $this->name($label, $name)); |
|
| 53 | 53 | $data->setType("checkbox"); |
| 54 | 54 | |
| 55 | 55 | columnSingleton()->setColumn($this->index, $data); |
@@ -64,8 +64,8 @@ discard block |
||
| 64 | 64 | $data = new PasswordModel(); |
| 65 | 65 | $data = $this->setDefaultModelValue($data); |
| 66 | 66 | $data->setLabel($label); |
| 67 | - $data->setName($this->name($label,$name)); |
|
| 68 | - $data->setField($field_to_save?:$this->name($label, $name)); |
|
| 67 | + $data->setName($this->name($label, $name)); |
|
| 68 | + $data->setField($field_to_save ?: $this->name($label, $name)); |
|
| 69 | 69 | $data->setType("password"); |
| 70 | 70 | $data->setShowDetail(false); |
| 71 | 71 | $data->setShowIndex(false); |
@@ -82,8 +82,8 @@ discard block |
||
| 82 | 82 | $data = new ImageModel(); |
| 83 | 83 | $data = $this->setDefaultModelValue($data); |
| 84 | 84 | $data->setLabel($label); |
| 85 | - $data->setName($this->name($label,$name)); |
|
| 86 | - $data->setField($field_to_save?:$this->name($label, $name)); |
|
| 85 | + $data->setName($this->name($label, $name)); |
|
| 86 | + $data->setField($field_to_save ?: $this->name($label, $name)); |
|
| 87 | 87 | $data->setType("image"); |
| 88 | 88 | |
| 89 | 89 | columnSingleton()->setColumn($this->index, $data); |
@@ -98,8 +98,8 @@ discard block |
||
| 98 | 98 | $data = new TextAreaModel(); |
| 99 | 99 | $data = $this->setDefaultModelValue($data); |
| 100 | 100 | $data->setLabel($label); |
| 101 | - $data->setName($this->name($label,$name)); |
|
| 102 | - $data->setField($field_to_save?:$this->name($label, $name)); |
|
| 101 | + $data->setName($this->name($label, $name)); |
|
| 102 | + $data->setField($field_to_save ?: $this->name($label, $name)); |
|
| 103 | 103 | $data->setType("text_area"); |
| 104 | 104 | |
| 105 | 105 | columnSingleton()->setColumn($this->index, $data); |
@@ -114,8 +114,8 @@ discard block |
||
| 114 | 114 | $data = new ColumnModel(); |
| 115 | 115 | $data = $this->setDefaultModelValue($data); |
| 116 | 116 | $data->setLabel($label); |
| 117 | - $data->setName($this->name($label,$name)); |
|
| 118 | - $data->setField($field_to_save?:$this->name($label, $name)); |
|
| 117 | + $data->setName($this->name($label, $name)); |
|
| 118 | + $data->setField($field_to_save ?: $this->name($label, $name)); |
|
| 119 | 119 | $data->setType("select"); |
| 120 | 120 | |
| 121 | 121 | columnSingleton()->setColumn($this->index, $data); |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | |
| 19 | 19 | private function name($label, $name = null) |
| 20 | 20 | { |
| 21 | - return (!$name)?strtolower(Str::slug($label,'_')):$name; |
|
| 21 | + return (!$name) ?strtolower(Str::slug($label, '_')) : $name; |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | /** |
@@ -38,9 +38,9 @@ discard block |
||
| 38 | 38 | public function getIndexColumns() |
| 39 | 39 | { |
| 40 | 40 | $data = $this->columns; |
| 41 | - foreach($data as $i=>$item) { |
|
| 41 | + foreach ($data as $i=>$item) { |
|
| 42 | 42 | /** @var ColumnModel $item */ |
| 43 | - if($item->getShowIndex() === false) { |
|
| 43 | + if ($item->getShowIndex() === false) { |
|
| 44 | 44 | unset($data[$i]); |
| 45 | 45 | } |
| 46 | 46 | } |
@@ -50,13 +50,13 @@ discard block |
||
| 50 | 50 | public function getAddEditColumns() |
| 51 | 51 | { |
| 52 | 52 | $data = $this->columns; |
| 53 | - foreach($data as $i=>$item) { |
|
| 53 | + foreach ($data as $i=>$item) { |
|
| 54 | 54 | /** @var ColumnModel $item */ |
| 55 | - if($item->getShowIndex() === false) { |
|
| 55 | + if ($item->getShowIndex() === false) { |
|
| 56 | 56 | unset($data[$i]); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - if($item->getShowDetail() === false) { |
|
| 59 | + if ($item->getShowDetail() === false) { |
|
| 60 | 60 | unset($data[$i]); |
| 61 | 61 | } |
| 62 | 62 | |
@@ -67,9 +67,9 @@ discard block |
||
| 67 | 67 | public function getEditColumns() |
| 68 | 68 | { |
| 69 | 69 | $data = $this->columns; |
| 70 | - foreach($data as $i=>$item) { |
|
| 70 | + foreach ($data as $i=>$item) { |
|
| 71 | 71 | /** @var ColumnModel $item */ |
| 72 | - if($item->getShowEdit() === false) { |
|
| 72 | + if ($item->getShowEdit() === false) { |
|
| 73 | 73 | unset($data[$i]); |
| 74 | 74 | } |
| 75 | 75 | } |
@@ -79,9 +79,9 @@ discard block |
||
| 79 | 79 | public function getAddColumns() |
| 80 | 80 | { |
| 81 | 81 | $data = $this->columns; |
| 82 | - foreach($data as $i=>$item) { |
|
| 82 | + foreach ($data as $i=>$item) { |
|
| 83 | 83 | /** @var ColumnModel $item */ |
| 84 | - if($item->getShowAdd() === false) { |
|
| 84 | + if ($item->getShowAdd() === false) { |
|
| 85 | 85 | unset($data[$i]); |
| 86 | 86 | } |
| 87 | 87 | } |
@@ -91,9 +91,9 @@ discard block |
||
| 91 | 91 | public function getDetailColumns() |
| 92 | 92 | { |
| 93 | 93 | $data = $this->columns; |
| 94 | - foreach($data as $i=>$item) { |
|
| 94 | + foreach ($data as $i=>$item) { |
|
| 95 | 95 | /** @var ColumnModel $item */ |
| 96 | - if($item->getShowDetail() === false) { |
|
| 96 | + if ($item->getShowDetail() === false) { |
|
| 97 | 97 | unset($data[$i]); |
| 98 | 98 | } |
| 99 | 99 | } |
@@ -103,13 +103,13 @@ discard block |
||
| 103 | 103 | public function getAssignmentData() |
| 104 | 104 | { |
| 105 | 105 | $data = []; |
| 106 | - foreach($this->columns as $column) { |
|
| 106 | + foreach ($this->columns as $column) { |
|
| 107 | 107 | /** @var ColumnModel $column */ |
| 108 | - if(is_array($column->getValue())) { |
|
| 109 | - foreach($column->getValue() as $key=>$val) { |
|
| 108 | + if (is_array($column->getValue())) { |
|
| 109 | + foreach ($column->getValue() as $key=>$val) { |
|
| 110 | 110 | $data[$key] = $val; |
| 111 | 111 | } |
| 112 | - }else{ |
|
| 112 | + } else { |
|
| 113 | 113 | $data[$column->getField()] = $column->getValue(); |
| 114 | 114 | } |
| 115 | 115 | } |
@@ -119,10 +119,10 @@ discard block |
||
| 119 | 119 | public function removeColumn($label_or_name) |
| 120 | 120 | { |
| 121 | 121 | $data = $this->getColumns(); |
| 122 | - foreach($data as $i=>$d) |
|
| 122 | + foreach ($data as $i=>$d) |
|
| 123 | 123 | { |
| 124 | 124 | /** @var ColumnModel $d */ |
| 125 | - if($d->getLabel() == $label_or_name || $d->getName() == $label_or_name) { |
|
| 125 | + if ($d->getLabel() == $label_or_name || $d->getName() == $label_or_name) { |
|
| 126 | 126 | unset($data[$i]); |
| 127 | 127 | } |
| 128 | 128 | } |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | public function getColumnNameOnly() |
| 133 | 133 | { |
| 134 | 134 | $result = []; |
| 135 | - foreach($this->columns as $column) { |
|
| 135 | + foreach ($this->columns as $column) { |
|
| 136 | 136 | /** @var ColumnModel $column */ |
| 137 | 137 | $result[] = $column->getName(); |
| 138 | 138 | } |