@@ -15,7 +15,7 @@ |
||
| 15 | 15 | public function getIndex() { |
| 16 | 16 | $data = []; |
| 17 | 17 | $data['page_title'] = "Dashboard"; |
| 18 | - return view('crudbooster::dev_layouts.modules.dashboard',$data); |
|
| 18 | + return view('crudbooster::dev_layouts.modules.dashboard', $data); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | public function getIndex() { |
| 27 | 27 | $data = []; |
| 28 | 28 | $data['result'] = DB::table("cb_modules")->get(); |
| 29 | - return view($this->view.'.index',$data); |
|
| 29 | + return view($this->view.'.index', $data); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | public function getAdd() { |
@@ -37,11 +37,11 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | public function postAddSave() { |
| 39 | 39 | try { |
| 40 | - cb()->validation(['name', 'table','icon']); |
|
| 40 | + cb()->validation(['name', 'table', 'icon']); |
|
| 41 | 41 | |
| 42 | 42 | (new ModuleGenerator(request('table'), request('name'), request('icon')))->make(); |
| 43 | 43 | |
| 44 | - return cb()->redirect(route("DeveloperModulesControllerGetIndex"),"New module has been created!","success"); |
|
| 44 | + return cb()->redirect(route("DeveloperModulesControllerGetIndex"), "New module has been created!", "success"); |
|
| 45 | 45 | |
| 46 | 46 | } catch (CBValidationException $e) { |
| 47 | 47 | return cb()->redirectBack($e->getMessage()); |
@@ -58,9 +58,9 @@ discard block |
||
| 58 | 58 | try { |
| 59 | 59 | cb()->validation(['name', 'icon']); |
| 60 | 60 | |
| 61 | - cb()->updateCompact("cb_modules", $id, ['name','icon']); |
|
| 61 | + cb()->updateCompact("cb_modules", $id, ['name', 'icon']); |
|
| 62 | 62 | |
| 63 | - return cb()->redirect(route("DeveloperModulesControllerGetIndex"),"Module has been updated!","success"); |
|
| 63 | + return cb()->redirect(route("DeveloperModulesControllerGetIndex"), "Module has been updated!", "success"); |
|
| 64 | 64 | |
| 65 | 65 | } catch (CBValidationException $e) { |
| 66 | 66 | return cb()->redirectBack($e->getMessage()); |
@@ -68,12 +68,12 @@ discard block |
||
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | public function getDelete($id) { |
| 71 | - $module = cb()->find("cb_modules",$id); |
|
| 71 | + $module = cb()->find("cb_modules", $id); |
|
| 72 | 72 | @unlink(app_path("Http/Controllers/".$module->controller)); |
| 73 | 73 | DB::table("cb_modules")->where("id", $id)->delete(); |
| 74 | 74 | DB::table("cb_menus")->where("cb_modules_id", $id)->delete(); |
| 75 | 75 | |
| 76 | - return cb()->redirectBack("The module has been deleted!","success"); |
|
| 76 | + return cb()->redirectBack("The module has been deleted!", "success"); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | } |
| 80 | 80 | \ No newline at end of file |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | public function getLogin() |
| 9 | 9 | { |
| 10 | - if(!auth()->guest()) return redirect(cb()->getAdminUrl()); |
|
| 10 | + if (!auth()->guest()) return redirect(cb()->getAdminUrl()); |
|
| 11 | 11 | |
| 12 | 12 | cbHook()->hookGetLogin(); |
| 13 | 13 | |
@@ -16,20 +16,20 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | public function postLogin() |
| 18 | 18 | { |
| 19 | - try{ |
|
| 19 | + try { |
|
| 20 | 20 | cb()->validation([ |
| 21 | 21 | 'email'=>'required|email', |
| 22 | 22 | 'password'=>'required' |
| 23 | 23 | ]); |
| 24 | - $credential = request()->only(['email','password']); |
|
| 24 | + $credential = request()->only(['email', 'password']); |
|
| 25 | 25 | if (auth()->attempt($credential)) { |
| 26 | 26 | cbHook()->hookPostLogin(); |
| 27 | 27 | return redirect(cb()->getAdminUrl()); |
| 28 | 28 | } else { |
| 29 | - return redirect(cb()->getLoginUrl())->with(['message'=>__('crudbooster.alert_password_wrong'),'message_type'=>'warning']); |
|
| 29 | + return redirect(cb()->getLoginUrl())->with(['message'=>__('crudbooster.alert_password_wrong'), 'message_type'=>'warning']); |
|
| 30 | 30 | } |
| 31 | - }catch (CBValidationException $e) { |
|
| 32 | - return cb()->redirect(cb()->getAdminUrl("login"),$e->getMessage(),'warning'); |
|
| 31 | + } catch (CBValidationException $e) { |
|
| 32 | + return cb()->redirect(cb()->getAdminUrl("login"), $e->getMessage(), 'warning'); |
|
| 33 | 33 | } |
| 34 | 34 | } |
| 35 | 35 | |
@@ -44,25 +44,25 @@ discard block |
||
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | public function postLoginDeveloper() { |
| 47 | - try{ |
|
| 47 | + try { |
|
| 48 | 48 | cb()->validation([ |
| 49 | 49 | 'username'=>'required', |
| 50 | 50 | 'password'=>'required' |
| 51 | 51 | ]); |
| 52 | 52 | |
| 53 | - if(request('username') == config('crudbooster.DEV_USERNAME') |
|
| 53 | + if (request('username') == config('crudbooster.DEV_USERNAME') |
|
| 54 | 54 | && request('password') == config('crudbooster.DEV_PASSWORD')) { |
| 55 | 55 | |
| 56 | 56 | session(['developer'=>1]); |
| 57 | 57 | |
| 58 | 58 | return redirect(cb()->getDeveloperUrl()); |
| 59 | 59 | |
| 60 | - }else{ |
|
| 60 | + } else { |
|
| 61 | 61 | return cb()->redirectBack("Username and or password is wrong!"); |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - }catch (CBValidationException $e) { |
|
| 65 | - return cb()->redirect(cb()->getLoginUrl(),$e->getMessage(),'warning'); |
|
| 64 | + } catch (CBValidationException $e) { |
|
| 65 | + return cb()->redirect(cb()->getLoginUrl(), $e->getMessage(), 'warning'); |
|
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | 68 | |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | | |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -if(!function_exists('convertPHPToMomentFormat')) { |
|
| 12 | +if (!function_exists('convertPHPToMomentFormat')) { |
|
| 13 | 13 | function convertPHPToMomentFormat($format) |
| 14 | 14 | { |
| 15 | 15 | $replacements = [ |
@@ -56,13 +56,13 @@ discard block |
||
| 56 | 56 | } |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | -if(!function_exists('slug')) { |
|
| 59 | +if (!function_exists('slug')) { |
|
| 60 | 60 | function slug($string, $separator = '-') { |
| 61 | 61 | return \Illuminate\Support\Str::slug($string, $separator); |
| 62 | 62 | } |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | -if(!function_exists('columnSingleton')) { |
|
| 65 | +if (!function_exists('columnSingleton')) { |
|
| 66 | 66 | /** |
| 67 | 67 | * @return \crocodicstudio\crudbooster\controllers\scaffolding\singletons\ColumnSingleton |
| 68 | 68 | */ |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | -if(!function_exists('cbHook')) |
|
| 74 | +if (!function_exists('cbHook')) |
|
| 75 | 75 | { |
| 76 | 76 | /** |
| 77 | 77 | * @return crocodicstudio\crudbooster\hooks\CBHook |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | -if(!function_exists('getTypeHook')) |
|
| 86 | +if (!function_exists('getTypeHook')) |
|
| 87 | 87 | { |
| 88 | 88 | /** |
| 89 | 89 | * @param string $type |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | -if(!function_exists('getPrimaryKey')) |
|
| 99 | +if (!function_exists('getPrimaryKey')) |
|
| 100 | 100 | { |
| 101 | 101 | function getPrimaryKey($table_name) |
| 102 | 102 | { |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | } |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | -if(!function_exists('cb')) |
|
| 107 | +if (!function_exists('cb')) |
|
| 108 | 108 | { |
| 109 | 109 | function cb() |
| 110 | 110 | { |
@@ -112,25 +112,25 @@ discard block |
||
| 112 | 112 | } |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | -if(!function_exists('cbAsset')) { |
|
| 115 | +if (!function_exists('cbAsset')) { |
|
| 116 | 116 | function cbAsset($path) { |
| 117 | 117 | return asset("cb_asset/".$path); |
| 118 | 118 | } |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | -if(!function_exists("cbConfig")) { |
|
| 121 | +if (!function_exists("cbConfig")) { |
|
| 122 | 122 | function cbConfig($name) { |
| 123 | 123 | return config("crudbooster.".$name); |
| 124 | 124 | } |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | -if(!function_exists("strRandom")) { |
|
| 127 | +if (!function_exists("strRandom")) { |
|
| 128 | 128 | function strRandom($length = 5) { |
| 129 | 129 | return \Illuminate\Support\Str::random($length); |
| 130 | 130 | } |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | -if(!function_exists('module')) { |
|
| 133 | +if (!function_exists('module')) { |
|
| 134 | 134 | function module() |
| 135 | 135 | { |
| 136 | 136 | $module = new \crocodicstudio\crudbooster\helpers\Module(); |
@@ -138,43 +138,43 @@ discard block |
||
| 138 | 138 | } |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | -if(!function_exists('getAdminLoginURL')) { |
|
| 141 | +if (!function_exists('getAdminLoginURL')) { |
|
| 142 | 142 | function getAdminLoginURL() |
| 143 | 143 | { |
| 144 | 144 | return url(config('crudbooster.ADMIN_LOGIN_PATH')); |
| 145 | 145 | } |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | -if(!function_exists('dummyPhoto')) { |
|
| 148 | +if (!function_exists('dummyPhoto')) { |
|
| 149 | 149 | function dummyPhoto() |
| 150 | 150 | { |
| 151 | 151 | return config('crudbooster.DUMMY_PHOTO'); |
| 152 | 152 | } |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | -if(!function_exists('assetThumbnail')) { |
|
| 155 | +if (!function_exists('assetThumbnail')) { |
|
| 156 | 156 | function assetThumbnail($path) { |
| 157 | - $path = str_replace('uploads/','uploads_thumbnail/',$path); |
|
| 157 | + $path = str_replace('uploads/', 'uploads_thumbnail/', $path); |
|
| 158 | 158 | return asset($path); |
| 159 | 159 | } |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | -if(!function_exists('assetResize')) { |
|
| 163 | - function assetResize($path,$width,$height=null,$quality=70) { |
|
| 162 | +if (!function_exists('assetResize')) { |
|
| 163 | + function assetResize($path, $width, $height = null, $quality = 70) { |
|
| 164 | 164 | $basename = basename($path); |
| 165 | 165 | $pathWithoutName = str_replace($basename, '', $path); |
| 166 | 166 | $newLocation = $pathWithoutName.'/w_'.$width.'_h_'.$height.'_'.$basename; |
| 167 | - if(Storage::exists($newLocation)) { |
|
| 167 | + if (Storage::exists($newLocation)) { |
|
| 168 | 168 | return asset($newLocation); |
| 169 | - }else{ |
|
| 170 | - $img = Image::make(storage_path($path))->fit($width,$height); |
|
| 171 | - $img->save(storage_path($newLocation),$quality); |
|
| 169 | + } else { |
|
| 170 | + $img = Image::make(storage_path($path))->fit($width, $height); |
|
| 171 | + $img->save(storage_path($newLocation), $quality); |
|
| 172 | 172 | return asset($newLocation); |
| 173 | 173 | } |
| 174 | 174 | } |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | -if(!function_exists('extract_unit')) { |
|
| 177 | +if (!function_exists('extract_unit')) { |
|
| 178 | 178 | /* |
| 179 | 179 | Credits: Bit Repository |
| 180 | 180 | URL: http://www.bitrepository.com/extract-content-between-two-delimiters-with-php.html |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | |
| 195 | -if(!function_exists('now')) { |
|
| 195 | +if (!function_exists('now')) { |
|
| 196 | 196 | function now() { |
| 197 | 197 | return date('Y-m-d H:i:s'); |
| 198 | 198 | } |
@@ -206,13 +206,13 @@ discard block |
||
| 206 | 206 | | |
| 207 | 207 | */ |
| 208 | 208 | |
| 209 | -if(!function_exists('putSetting')) { |
|
| 209 | +if (!function_exists('putSetting')) { |
|
| 210 | 210 | function putSetting($key, $value) |
| 211 | 211 | { |
| 212 | - if(file_exists(storage_path('.cbconfig'))) { |
|
| 212 | + if (file_exists(storage_path('.cbconfig'))) { |
|
| 213 | 213 | $settings = file_get_contents(storage_path('.cbconfig')); |
| 214 | 214 | $settings = unserialize($settings); |
| 215 | - }else{ |
|
| 215 | + } else { |
|
| 216 | 216 | $settings = []; |
| 217 | 217 | } |
| 218 | 218 | |
@@ -223,25 +223,25 @@ discard block |
||
| 223 | 223 | } |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | -if(!function_exists('getSetting')) { |
|
| 226 | +if (!function_exists('getSetting')) { |
|
| 227 | 227 | function getSetting($key, $default = null) |
| 228 | 228 | { |
| 229 | - if(file_exists(storage_path('.cbconfig'))) { |
|
| 229 | + if (file_exists(storage_path('.cbconfig'))) { |
|
| 230 | 230 | $settings = file_get_contents(storage_path('.cbconfig')); |
| 231 | 231 | $settings = unserialize($settings); |
| 232 | - }else{ |
|
| 232 | + } else { |
|
| 233 | 233 | $settings = []; |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | - if(isset($settings[$key])) { |
|
| 237 | - return $settings[$key]?:$default; |
|
| 238 | - }else{ |
|
| 236 | + if (isset($settings[$key])) { |
|
| 237 | + return $settings[$key] ?: $default; |
|
| 238 | + } else { |
|
| 239 | 239 | return $default; |
| 240 | 240 | } |
| 241 | 241 | } |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | -if(!function_exists('timeAgo')) { |
|
| 244 | +if (!function_exists('timeAgo')) { |
|
| 245 | 245 | function timeAgo($datetime_to, $datetime_from = null, $full = false) |
| 246 | 246 | { |
| 247 | 247 | $datetime_from = ($datetime_from) ?: date('Y-m-d H:i:s'); |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | } |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | - if (! $full) { |
|
| 275 | + if (!$full) { |
|
| 276 | 276 | $string = array_slice($string, 0, 1); |
| 277 | 277 | } |
| 278 | 278 | |
@@ -280,22 +280,22 @@ discard block |
||
| 280 | 280 | } |
| 281 | 281 | } |
| 282 | 282 | |
| 283 | -if(!function_exists("array_map_r")) { |
|
| 284 | - function array_map_r( $func, $arr ) |
|
| 283 | +if (!function_exists("array_map_r")) { |
|
| 284 | + function array_map_r($func, $arr) |
|
| 285 | 285 | { |
| 286 | 286 | $newArr = array(); |
| 287 | 287 | |
| 288 | - foreach( $arr as $key => $value ) |
|
| 288 | + foreach ($arr as $key => $value) |
|
| 289 | 289 | { |
| 290 | 290 | $key = $func($key); |
| 291 | - $newArr[ $key ] = ( is_array( $value ) ? array_map_r( $func, $value ) : ( is_array($func) ? call_user_func_array($func, $value) : $func( $value ) ) ); |
|
| 291 | + $newArr[$key] = (is_array($value) ? array_map_r($func, $value) : (is_array($func) ? call_user_func_array($func, $value) : $func($value))); |
|
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | return $newArr; |
| 295 | 295 | } |
| 296 | 296 | } |
| 297 | 297 | |
| 298 | -if(!function_exists("sanitizeXSS")) |
|
| 298 | +if (!function_exists("sanitizeXSS")) |
|
| 299 | 299 | { |
| 300 | 300 | function sanitizeXSS($value) |
| 301 | 301 | { |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | } |
| 308 | 308 | } |
| 309 | 309 | |
| 310 | -if(!function_exists("requestAll")) { |
|
| 310 | +if (!function_exists("requestAll")) { |
|
| 311 | 311 | function requestAll() { |
| 312 | 312 | $all = array_map_r("sanitizeXSS", request()->all()); |
| 313 | 313 | return $all; |
@@ -316,22 +316,22 @@ discard block |
||
| 316 | 316 | |
| 317 | 317 | |
| 318 | 318 | |
| 319 | -if(!function_exists('getURLFormat')) { |
|
| 319 | +if (!function_exists('getURLFormat')) { |
|
| 320 | 320 | function getURLFormat($name) { |
| 321 | 321 | $url = request($name); |
| 322 | - if(filter_var($url, FILTER_VALIDATE_URL)) { |
|
| 322 | + if (filter_var($url, FILTER_VALIDATE_URL)) { |
|
| 323 | 323 | return $url; |
| 324 | - }else{ |
|
| 324 | + } else { |
|
| 325 | 325 | return request()->url(); |
| 326 | 326 | } |
| 327 | 327 | } |
| 328 | 328 | } |
| 329 | 329 | |
| 330 | -if(!function_exists('g')) { |
|
| 330 | +if (!function_exists('g')) { |
|
| 331 | 331 | function g($name, $safe = true) { |
| 332 | - if($safe == true) { |
|
| 332 | + if ($safe == true) { |
|
| 333 | 333 | $response = request($name); |
| 334 | - if(is_string($response)) { |
|
| 334 | + if (is_string($response)) { |
|
| 335 | 335 | $response = sanitizeXSS($response); |
| 336 | 336 | }elseif (is_array($response)) { |
| 337 | 337 | array_walk_recursive($response, function(&$response) { |
@@ -340,25 +340,25 @@ discard block |
||
| 340 | 340 | } |
| 341 | 341 | |
| 342 | 342 | return $response; |
| 343 | - }else{ |
|
| 343 | + } else { |
|
| 344 | 344 | return Request::get($name); |
| 345 | 345 | } |
| 346 | 346 | } |
| 347 | 347 | } |
| 348 | 348 | |
| 349 | -if(!function_exists('min_var_export')) { |
|
| 349 | +if (!function_exists('min_var_export')) { |
|
| 350 | 350 | function min_var_export($input) { |
| 351 | - if(is_array($input)) { |
|
| 351 | + if (is_array($input)) { |
|
| 352 | 352 | $buffer = []; |
| 353 | - foreach($input as $key => $value) |
|
| 353 | + foreach ($input as $key => $value) |
|
| 354 | 354 | $buffer[] = var_export($key, true)."=>".min_var_export($value); |
| 355 | - return "[".implode(",",$buffer)."]"; |
|
| 355 | + return "[".implode(",", $buffer)."]"; |
|
| 356 | 356 | } else |
| 357 | 357 | return var_export($input, true); |
| 358 | 358 | } |
| 359 | 359 | } |
| 360 | 360 | |
| 361 | -if(!function_exists('rrmdir')) { |
|
| 361 | +if (!function_exists('rrmdir')) { |
|
| 362 | 362 | /* |
| 363 | 363 | * http://stackoverflow.com/questions/3338123/how-do-i-recursively-delete-a-directory-and-its-entire-contents-files-sub-dir |
| 364 | 364 | */ |
@@ -20,9 +20,9 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | public function indexRender($row, $column) |
| 22 | 22 | { |
| 23 | - if($column->getFormat()) { |
|
| 23 | + if ($column->getFormat()) { |
|
| 24 | 24 | return date($column->getFormat(), strtotime($row->{$column->getField()})); |
| 25 | - }else{ |
|
| 25 | + } else { |
|
| 26 | 26 | return $row->{$column->getField()}; |
| 27 | 27 | } |
| 28 | 28 | } |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | public function optionsFromTable($table, $key_field, $display_field, $SQLCondition = null) { |
| 36 | 36 | $data = DB::table($table); |
| 37 | - if($SQLCondition && is_callable($SQLCondition)) { |
|
| 37 | + if ($SQLCondition && is_callable($SQLCondition)) { |
|
| 38 | 38 | $data = call_user_func($SQLCondition, $data); |
| 39 | 39 | }elseif ($SQLCondition && is_string($SQLCondition)) { |
| 40 | 40 | $data->whereRaw($SQLCondition); |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | $data = $data->get(); |
| 43 | 43 | $options = []; |
| 44 | 44 | foreach ($data as $d) { |
| 45 | - $options[ $d->$key_field ] = $d->$display_field; |
|
| 45 | + $options[$d->$key_field] = $d->$display_field; |
|
| 46 | 46 | } |
| 47 | 47 | $this->options($options); |
| 48 | 48 | } |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | public function optionsFromTable($table, $key_field, $display_field, $SQLCondition = null) { |
| 27 | 27 | $data = DB::table($table); |
| 28 | - if($SQLCondition && is_callable($SQLCondition)) { |
|
| 28 | + if ($SQLCondition && is_callable($SQLCondition)) { |
|
| 29 | 29 | $data = call_user_func($SQLCondition, $data); |
| 30 | 30 | }elseif ($SQLCondition && is_string($SQLCondition)) { |
| 31 | 31 | $data->whereRaw($SQLCondition); |
@@ -33,11 +33,11 @@ discard block |
||
| 33 | 33 | $data = $data->get(); |
| 34 | 34 | $options = []; |
| 35 | 35 | foreach ($data as $d) { |
| 36 | - $options[ $d->$key_field ] = $d->$display_field; |
|
| 36 | + $options[$d->$key_field] = $d->$display_field; |
|
| 37 | 37 | } |
| 38 | 38 | $data = columnSingleton()->getColumn($this->index); |
| 39 | 39 | /** @var $data SelectModel */ |
| 40 | - $data->setOptionsFromTable(["table"=>$table,"key_field"=>$key_field,"display_field"=>$display_field]); |
|
| 40 | + $data->setOptionsFromTable(["table"=>$table, "key_field"=>$key_field, "display_field"=>$display_field]); |
|
| 41 | 41 | columnSingleton()->setColumn($this->index, $data); |
| 42 | 42 | |
| 43 | 43 | $this->options($options); |
@@ -19,9 +19,9 @@ discard block |
||
| 19 | 19 | */ |
| 20 | 20 | public function query($query, $column) |
| 21 | 21 | { |
| 22 | - if($column->getOptionsFromTable()) { |
|
| 22 | + if ($column->getOptionsFromTable()) { |
|
| 23 | 23 | $option = $column->getOptionsFromTable(); |
| 24 | - $query->join($option["table"],$option["table"].'.'.$option["key_field"],"=", $column->getName()); |
|
| 24 | + $query->join($option["table"], $option["table"].'.'.$option["key_field"], "=", $column->getName()); |
|
| 25 | 25 | $query->addSelect($option['table'].'.'.$option['display_field'].' as '.$option['table'].'_'.$option['display_field']); |
| 26 | 26 | } |
| 27 | 27 | return $query; |
@@ -33,13 +33,13 @@ discard block |
||
| 33 | 33 | */ |
| 34 | 34 | public function indexRender($row, $column) |
| 35 | 35 | { |
| 36 | - if($column->getOptionsFromTable()) { |
|
| 36 | + if ($column->getOptionsFromTable()) { |
|
| 37 | 37 | $option = $column->getOptionsFromTable(); |
| 38 | 38 | return $row->{ $option['table'].'_'.$option['display_field'] }; |
| 39 | - }else{ |
|
| 39 | + } else { |
|
| 40 | 40 | $option = $column->getOptions(); |
| 41 | 41 | $key = $row->{ $column->getField() }; |
| 42 | - return @$option[ $key ]; |
|
| 42 | + return @$option[$key]; |
|
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | public function up() |
| 14 | 14 | { |
| 15 | - Schema::create('cb_menus', function (Blueprint $table) { |
|
| 15 | + Schema::create('cb_menus', function(Blueprint $table) { |
|
| 16 | 16 | $table->increments("id"); |
| 17 | 17 | $table->string('name'); |
| 18 | 18 | $table->string("icon")->nullable(); |