@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | $model->setIcon($menu->icon); |
| 28 | 28 | $model->setName($menu->name); |
| 29 | 29 | $model->setBasepath(basename($model->getUrl())); |
| 30 | - }elseif ($menu->type == "module") { |
|
| 30 | + } elseif ($menu->type == "module") { |
|
| 31 | 31 | $module = cb()->find("cb_modules", $menu->cb_modules_id); |
| 32 | 32 | $className = '\App\Http\Controllers\\'.$module->controller; |
| 33 | 33 | $controllerClass = new $className(); |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | $model->setIcon($module->icon); |
| 37 | 37 | $model->setName($module->name); |
| 38 | 38 | $model->setBasepath(config('crudbooster.ADMIN_PATH').'/'.basename($model->getUrl())); |
| 39 | - }elseif ($menu->type == "path") { |
|
| 39 | + } elseif ($menu->type == "path") { |
|
| 40 | 40 | $model->setUrl(cb()->getAdminUrl($menu->path)); |
| 41 | 41 | $model->setIcon($menu->icon); |
| 42 | 42 | $model->setName($menu->name); |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | if(request()->is($model->getBasepath()."*")) { |
| 47 | 47 | $model->setIsActive(true); |
| 48 | - }else{ |
|
| 48 | + } else{ |
|
| 49 | 49 | $model->setIsActive(false); |
| 50 | 50 | } |
| 51 | 51 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | $menus = DB::table("cb_menus"); |
| 57 | 57 | if($parent_id) { |
| 58 | 58 | $menus->where("parent_cb_menus_id",$parent_id); |
| 59 | - }else{ |
|
| 59 | + } else{ |
|
| 60 | 60 | $menus->whereNull("parent_cb_menus_id"); |
| 61 | 61 | } |
| 62 | 62 | return $menus->orderBy("sort_number","asc")->get(); |
@@ -84,26 +84,36 @@ discard block |
||
| 84 | 84 | $menus_active = false; |
| 85 | 85 | foreach($menus as $menu) { |
| 86 | 86 | |
| 87 | - if($withPrivilege && !$this->checkPrivilege($roles_id, $menu)) continue; |
|
| 87 | + if($withPrivilege && !$this->checkPrivilege($roles_id, $menu)) { |
|
| 88 | + continue; |
|
| 89 | + } |
|
| 88 | 90 | |
| 89 | 91 | $sidebarModel = $this->assignToModel($menu); |
| 90 | - if($sidebarModel->getisActive()) $menus_active = true; |
|
| 92 | + if($sidebarModel->getisActive()) { |
|
| 93 | + $menus_active = true; |
|
| 94 | + } |
|
| 91 | 95 | if($menus2 = $this->loadData($menu->id)) { |
| 92 | 96 | $sub1 = []; |
| 93 | 97 | $menus2_active = false; |
| 94 | 98 | foreach ($menus2 as $menu2) { |
| 95 | 99 | |
| 96 | - if($withPrivilege && !$this->checkPrivilege($roles_id, $menu2)) continue; |
|
| 100 | + if($withPrivilege && !$this->checkPrivilege($roles_id, $menu2)) { |
|
| 101 | + continue; |
|
| 102 | + } |
|
| 97 | 103 | |
| 98 | 104 | $sidebarModel2 = $this->assignToModel($menu2); |
| 99 | - if($sidebarModel2->getisActive()) $menus2_active = true; |
|
| 105 | + if($sidebarModel2->getisActive()) { |
|
| 106 | + $menus2_active = true; |
|
| 107 | + } |
|
| 100 | 108 | |
| 101 | 109 | if($menus3 = $this->loadData($menu2->id)) { |
| 102 | 110 | $sub2 = []; |
| 103 | 111 | $menus3_active = false; |
| 104 | 112 | foreach ($menus3 as $menu3) { |
| 105 | 113 | |
| 106 | - if($withPrivilege && !$this->checkPrivilege($roles_id, $menu3)) continue; |
|
| 114 | + if($withPrivilege && !$this->checkPrivilege($roles_id, $menu3)) { |
|
| 115 | + continue; |
|
| 116 | + } |
|
| 107 | 117 | |
| 108 | 118 | $sidebarModel3 = $this->assignToModel($menu3); |
| 109 | 119 | |
@@ -14,7 +14,9 @@ |
||
| 14 | 14 | { |
| 15 | 15 | public function postUploadFile() |
| 16 | 16 | { |
| 17 | - if(auth()->guest()) return redirect(cb()->getLoginUrl()); |
|
| 17 | + if(auth()->guest()) { |
|
| 18 | + return redirect(cb()->getLoginUrl()); |
|
| 19 | + } |
|
| 18 | 20 | |
| 19 | 21 | $file = null; |
| 20 | 22 | try { |
@@ -14,7 +14,9 @@ |
||
| 14 | 14 | { |
| 15 | 15 | public function postUploadImage() |
| 16 | 16 | { |
| 17 | - if(auth()->guest()) return redirect(cb()->getLoginUrl()); |
|
| 17 | + if(auth()->guest()) { |
|
| 18 | + return redirect(cb()->getLoginUrl()); |
|
| 19 | + } |
|
| 18 | 20 | |
| 19 | 21 | $file = null; |
| 20 | 22 | try { |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | /** @var ColumnModel $column */ |
| 50 | 50 | if($data_row) { |
| 51 | 51 | $value = (isset($data_row->{$column->getField()}))?$data_row->{ $column->getField() }:null; |
| 52 | - }else{ |
|
| 52 | + } else{ |
|
| 53 | 53 | $value = request($column->getName()); |
| 54 | 54 | |
| 55 | 55 | if(!$value && $column->getDefaultValue()) { |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | foreach($column->getValue() as $key=>$val) { |
| 140 | 140 | $data[$key] = $val; |
| 141 | 141 | } |
| 142 | - }else{ |
|
| 142 | + } else{ |
|
| 143 | 143 | $data[$column->getField()] = $column->getValue(); |
| 144 | 144 | } |
| 145 | 145 | } |
@@ -29,14 +29,16 @@ |
||
| 29 | 29 | { |
| 30 | 30 | foreach ( $_POST as $key => $value ) |
| 31 | 31 | { |
| 32 | - if ( ( !is_string($value) && !is_numeric($value) ) || !is_string($key) ) |
|
| 33 | - continue; |
|
| 32 | + if ( ( !is_string($value) && !is_numeric($value) ) || !is_string($key) ) { |
|
| 33 | + continue; |
|
| 34 | + } |
|
| 34 | 35 | |
| 35 | - if ( get_magic_quotes_gpc() ) |
|
| 36 | - $value = htmlspecialchars( stripslashes((string)$value) ); |
|
| 37 | - else |
|
| 38 | - $value = htmlspecialchars( (string)$value ); |
|
| 39 | -?> |
|
| 36 | + if ( get_magic_quotes_gpc() ) { |
|
| 37 | + $value = htmlspecialchars( stripslashes((string)$value) ); |
|
| 38 | + } else { |
|
| 39 | + $value = htmlspecialchars( (string)$value ); |
|
| 40 | + } |
|
| 41 | + ?> |
|
| 40 | 42 | <tr> |
| 41 | 43 | <th style="vertical-align: top"><?php echo htmlspecialchars( (string)$key ); ?></th> |
| 42 | 44 | <td><pre class="samples"><?php echo $value; ?></pre></td> |
@@ -36,7 +36,7 @@ discard block |
||
| 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 | 41 | $this->call("db:seed",["--class"=>"CbMigrationSeeder"]); |
| 42 | 42 | $this->info("== Finish =="); |
@@ -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 | |
@@ -37,7 +37,7 @@ |
||
| 37 | 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 | } |
@@ -30,10 +30,10 @@ discard block |
||
| 30 | 30 | $key = $parameters[0]; |
| 31 | 31 | if(isset($this->data[$key])) { |
| 32 | 32 | return $this->data[$key]; |
| 33 | - }else{ |
|
| 33 | + } else{ |
|
| 34 | 34 | return null; |
| 35 | 35 | } |
| 36 | - }else{ |
|
| 36 | + } else{ |
|
| 37 | 37 | return null; |
| 38 | 38 | } |
| 39 | 39 | } |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | if(Schema::hasColumn($this->data['table'], $column->getField())) { |
| 78 | 78 | $query->addSelect($this->data['table'].'.'.$column->getField()); |
| 79 | 79 | } |
| 80 | - }else{ |
|
| 80 | + } else{ |
|
| 81 | 81 | $query->addSelect($column->getField()); |
| 82 | 82 | } |
| 83 | 83 | } |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | { |
| 90 | 90 | if(isset($this->data['hook_search_query'])) { |
| 91 | 91 | $query = call_user_func($this->data['hook_search_query'], $query); |
| 92 | - }else{ |
|
| 92 | + } else{ |
|
| 93 | 93 | $query->where(function ($where) use ($columns) { |
| 94 | 94 | /** |
| 95 | 95 | * @var $where Builder |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | { |
| 99 | 99 | if(strpos($column->getField(),".") === false) { |
| 100 | 100 | $field = $this->data['table'].'.'.$column->getField(); |
| 101 | - }else{ |
|
| 101 | + } else{ |
|
| 102 | 102 | $field = $column->getField(); |
| 103 | 103 | } |
| 104 | 104 | $where->orWhere($field, 'like', '%'.request('q').'%'); |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | if(in_array(request('order_by'),columnSingleton()->getColumnNameOnly())) { |
| 118 | 118 | $query->orderBy(request('order_by'), request('order_sort')); |
| 119 | 119 | } |
| 120 | - }else{ |
|
| 120 | + } else{ |
|
| 121 | 121 | $query->orderBy($this->data['table'].'.'.cb()->findPrimaryKey($this->data['table']), "desc"); |
| 122 | 122 | } |
| 123 | 123 | |
@@ -126,7 +126,9 @@ discard block |
||
| 126 | 126 | |
| 127 | 127 | public function getIndex() |
| 128 | 128 | { |
| 129 | - if(!module()->canBrowse()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
| 129 | + if(!module()->canBrowse()) { |
|
| 130 | + return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
| 131 | + } |
|
| 130 | 132 | |
| 131 | 133 | $query = $this->repository(); |
| 132 | 134 | $result = $query->paginate( request("limit")?:cbConfig("LIMIT_TABLE_DATA") ); |
@@ -153,7 +155,9 @@ discard block |
||
| 153 | 155 | |
| 154 | 156 | public function getAdd() |
| 155 | 157 | { |
| 156 | - if(!module()->canCreate()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
| 158 | + if(!module()->canCreate()) { |
|
| 159 | + return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
| 160 | + } |
|
| 157 | 161 | |
| 158 | 162 | $data = []; |
| 159 | 163 | $data['page_title'] = $this->data['page_title'].' : Add'; |
@@ -163,7 +167,9 @@ discard block |
||
| 163 | 167 | |
| 164 | 168 | public function postAddSave() |
| 165 | 169 | { |
| 166 | - if(!module()->canCreate()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
| 170 | + if(!module()->canCreate()) { |
|
| 171 | + return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
| 172 | + } |
|
| 167 | 173 | |
| 168 | 174 | try { |
| 169 | 175 | $this->validation(); |
@@ -204,7 +210,9 @@ discard block |
||
| 204 | 210 | |
| 205 | 211 | public function getEdit($id) |
| 206 | 212 | { |
| 207 | - if(!module()->canUpdate()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
| 213 | + if(!module()->canUpdate()) { |
|
| 214 | + return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
| 215 | + } |
|
| 208 | 216 | |
| 209 | 217 | $data = []; |
| 210 | 218 | $data['row'] = $this->repository()->where($this->data['table'].'.'.getPrimaryKey($this->data['table']), $id)->first(); |
@@ -215,7 +223,9 @@ discard block |
||
| 215 | 223 | |
| 216 | 224 | public function postEditSave($id) |
| 217 | 225 | { |
| 218 | - if(!module()->canUpdate()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
| 226 | + if(!module()->canUpdate()) { |
|
| 227 | + return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
| 228 | + } |
|
| 219 | 229 | |
| 220 | 230 | try { |
| 221 | 231 | $this->validation(); |
@@ -259,7 +269,9 @@ discard block |
||
| 259 | 269 | |
| 260 | 270 | public function getDelete($id) |
| 261 | 271 | { |
| 262 | - if(!module()->canDelete()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
| 272 | + if(!module()->canDelete()) { |
|
| 273 | + return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
| 274 | + } |
|
| 263 | 275 | |
| 264 | 276 | if(isset($this->data['hook_before_delete']) && is_callable($this->data['hook_before_delete'])) { |
| 265 | 277 | call_user_func($this->data['hook_before_delete'], $id); |
@@ -286,7 +298,9 @@ discard block |
||
| 286 | 298 | |
| 287 | 299 | public function getDetail($id) |
| 288 | 300 | { |
| 289 | - if(!module()->canRead()) return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
| 301 | + if(!module()->canRead()) { |
|
| 302 | + return cb()->redirect(cb()->getAdminUrl(),"You do not have a privilege access to this area"); |
|
| 303 | + } |
|
| 290 | 304 | |
| 291 | 305 | $data = []; |
| 292 | 306 | $data['row'] = $this->repository()->where($this->data['table'].'.'.getPrimaryKey($this->data['table']), $id)->first(); |
@@ -8,7 +8,9 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | public function getLogin() |
| 10 | 10 | { |
| 11 | - if(!auth()->guest()) return redirect(cb()->getAdminUrl()); |
|
| 11 | + if(!auth()->guest()) { |
|
| 12 | + return redirect(cb()->getAdminUrl()); |
|
| 13 | + } |
|
| 12 | 14 | |
| 13 | 15 | cbHook()->hookGetLogin(); |
| 14 | 16 | |
@@ -29,7 +31,7 @@ discard block |
||
| 29 | 31 | } else { |
| 30 | 32 | return redirect(cb()->getLoginUrl())->with(['message'=>__('crudbooster.password_and_username_is_wrong'),'message_type'=>'warning']); |
| 31 | 33 | } |
| 32 | - }catch (CBValidationException $e) { |
|
| 34 | + } catch (CBValidationException $e) { |
|
| 33 | 35 | return cb()->redirect(cb()->getAdminUrl("login"),$e->getMessage(),'warning'); |
| 34 | 36 | } |
| 35 | 37 | } |
@@ -58,11 +60,11 @@ discard block |
||
| 58 | 60 | |
| 59 | 61 | return redirect(cb()->getDeveloperUrl()); |
| 60 | 62 | |
| 61 | - }else{ |
|
| 63 | + } else{ |
|
| 62 | 64 | return cb()->redirectBack(__("crudbooster.password_and_username_is_wrong")); |
| 63 | 65 | } |
| 64 | 66 | |
| 65 | - }catch (CBValidationException $e) { |
|
| 67 | + } catch (CBValidationException $e) { |
|
| 66 | 68 | return cb()->redirect(cb()->getLoginUrl(),$e->getMessage(),'warning'); |
| 67 | 69 | } |
| 68 | 70 | } |