@@ -3,58 +3,58 @@ discard block |
||
| 3 | 3 | /* |
| 4 | 4 | * Theme Helper |
| 5 | 5 | */ |
| 6 | -if(!function_exists("themeLoginBackground")) { |
|
| 6 | +if (!function_exists("themeLoginBackground")) { |
|
| 7 | 7 | function themeLoginBackground() { |
| 8 | 8 | return "crudbooster::layouts.login_background_css"; |
| 9 | 9 | } |
| 10 | 10 | } |
| 11 | -if(!function_exists("themeFlashMessage")) { |
|
| 11 | +if (!function_exists("themeFlashMessage")) { |
|
| 12 | 12 | function themeFlashMessage() { |
| 13 | 13 | return "crudbooster::layouts.flash_message"; |
| 14 | 14 | } |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | -if(!function_exists("themeAlertMessage")) { |
|
| 17 | +if (!function_exists("themeAlertMessage")) { |
|
| 18 | 18 | function themeAlertMessage() { |
| 19 | 19 | return "crudbooster::layouts.alert_message"; |
| 20 | 20 | } |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | -if(!function_exists("themeLayoutPageTitleAndButton")) { |
|
| 23 | +if (!function_exists("themeLayoutPageTitleAndButton")) { |
|
| 24 | 24 | function themeLayoutPageTitleAndButton() { |
| 25 | 25 | return 'crudbooster::module.index.index_head_buttons'; |
| 26 | 26 | } |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | -if(!function_exists("themeLayoutHead")) { |
|
| 29 | +if (!function_exists("themeLayoutHead")) { |
|
| 30 | 30 | function themeLayoutHead() { |
| 31 | 31 | return "crudbooster::layouts.head"; |
| 32 | 32 | } |
| 33 | 33 | } |
| 34 | -if(!function_exists("themeTitle")) { |
|
| 34 | +if (!function_exists("themeTitle")) { |
|
| 35 | 35 | function themeTitle($page_title) { |
| 36 | - $page_title = isset($page_title)?$page_title:module()->getPageTitle(); |
|
| 37 | - return (isset($page_title))?cb()->getAppName().': '.strip_tags($page_title):"Admin Area"; |
|
| 36 | + $page_title = isset($page_title) ? $page_title : module()->getPageTitle(); |
|
| 37 | + return (isset($page_title)) ?cb()->getAppName().': '.strip_tags($page_title) : "Admin Area"; |
|
| 38 | 38 | } |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | -if(!function_exists("getThemePath")) { |
|
| 41 | +if (!function_exists("getThemePath")) { |
|
| 42 | 42 | function getThemePath($path = null) { |
| 43 | - return getSetting("theme_path", "crudbooster::themes.adminlte").(($path)?".".$path:null); |
|
| 43 | + return getSetting("theme_path", "crudbooster::themes.adminlte").(($path) ? ".".$path : null); |
|
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | // End Theme Helper |
| 48 | 48 | |
| 49 | -if(!function_exists("isConfigCached")) { |
|
| 49 | +if (!function_exists("isConfigCached")) { |
|
| 50 | 50 | function isConfigCached() |
| 51 | 51 | { |
| 52 | - if(env("APP_NAME")=="" || env("APP_NAME")==null) return true; |
|
| 52 | + if (env("APP_NAME") == "" || env("APP_NAME") == null) return true; |
|
| 53 | 53 | else return false; |
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | -if(!function_exists("miscellanousSingleton")) { |
|
| 57 | +if (!function_exists("miscellanousSingleton")) { |
|
| 58 | 58 | /** |
| 59 | 59 | * @return \crocodicstudio\crudbooster\helpers\MiscellanousSingleton |
| 60 | 60 | */ |
@@ -63,14 +63,14 @@ discard block |
||
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | -if(!function_exists("makeReferalUrl")) { |
|
| 66 | +if (!function_exists("makeReferalUrl")) { |
|
| 67 | 67 | function makeReferalUrl($name = null) { |
| 68 | 68 | $ref = []; |
| 69 | 69 | $ref['url'] = request()->fullUrl(); |
| 70 | 70 | $ref['name'] = $name; |
| 71 | 71 | $md5Hash = md5(serialize($ref)); |
| 72 | 72 | |
| 73 | - if($exist = \Illuminate\Support\Facades\Cache::get("refurl_".$md5Hash)) { |
|
| 73 | + if ($exist = \Illuminate\Support\Facades\Cache::get("refurl_".$md5Hash)) { |
|
| 74 | 74 | return $exist['id']; |
| 75 | 75 | } |
| 76 | 76 | |
@@ -82,12 +82,12 @@ discard block |
||
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | -if(!function_exists("getReferalUrl")) { |
|
| 85 | +if (!function_exists("getReferalUrl")) { |
|
| 86 | 86 | function getReferalUrl($key = null) { |
| 87 | - if(verifyReferalUrl()) { |
|
| 87 | + if (verifyReferalUrl()) { |
|
| 88 | 88 | $md5hash = \Illuminate\Support\Facades\Cache::get("refurl_token_".request("ref")); |
| 89 | 89 | $ref = \Illuminate\Support\Facades\Cache::get("refurl_".$md5hash); |
| 90 | - if($key) { |
|
| 90 | + if ($key) { |
|
| 91 | 91 | return @$ref[$key]; |
| 92 | 92 | } else { |
| 93 | 93 | return $ref; |
@@ -97,13 +97,13 @@ discard block |
||
| 97 | 97 | } |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | -if(!function_exists("verifyReferalUrl")) { |
|
| 100 | +if (!function_exists("verifyReferalUrl")) { |
|
| 101 | 101 | function verifyReferalUrl() |
| 102 | 102 | { |
| 103 | - if(request("ref")) { |
|
| 104 | - if($md5hash = \Illuminate\Support\Facades\Cache::get("refurl_token_".request("ref"))) { |
|
| 103 | + if (request("ref")) { |
|
| 104 | + if ($md5hash = \Illuminate\Support\Facades\Cache::get("refurl_token_".request("ref"))) { |
|
| 105 | 105 | $ref = \Illuminate\Support\Facades\Cache::get("refurl_".$md5hash); |
| 106 | - if(filter_var($ref['url'], FILTER_VALIDATE_URL)) { |
|
| 106 | + if (filter_var($ref['url'], FILTER_VALIDATE_URL)) { |
|
| 107 | 107 | return true; |
| 108 | 108 | } |
| 109 | 109 | } |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | } |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | -if(!function_exists("putHtaccess")) { |
|
| 115 | +if (!function_exists("putHtaccess")) { |
|
| 116 | 116 | function putHtaccess($stringToPut) |
| 117 | 117 | { |
| 118 | 118 | file_put_contents(base_path(".htaccess"), "\n".$stringToPut, FILE_APPEND); |
@@ -120,13 +120,13 @@ discard block |
||
| 120 | 120 | } |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | -if(!function_exists("checkHtaccess")) { |
|
| 123 | +if (!function_exists("checkHtaccess")) { |
|
| 124 | 124 | function checkHtaccess($stringToCheck) |
| 125 | 125 | { |
| 126 | - if(file_exists(base_path(".htaccess")) && file_exists(public_path(".htaccess"))) { |
|
| 126 | + if (file_exists(base_path(".htaccess")) && file_exists(public_path(".htaccess"))) { |
|
| 127 | 127 | $htaccess = file_get_contents(base_path(".htaccess")); |
| 128 | - $htaccess2= file_get_contents(public_path(".htaccess")); |
|
| 129 | - if(\Illuminate\Support\Str::contains($htaccess, $stringToCheck) && \Illuminate\Support\Str::contains($htaccess2, $stringToCheck)) { |
|
| 128 | + $htaccess2 = file_get_contents(public_path(".htaccess")); |
|
| 129 | + if (\Illuminate\Support\Str::contains($htaccess, $stringToCheck) && \Illuminate\Support\Str::contains($htaccess2, $stringToCheck)) { |
|
| 130 | 130 | return true; |
| 131 | 131 | } |
| 132 | 132 | } |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | } |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | -if(!function_exists("setEnvironmentValue")) { |
|
| 138 | +if (!function_exists("setEnvironmentValue")) { |
|
| 139 | 139 | function setEnvironmentValue(array $values) |
| 140 | 140 | { |
| 141 | 141 | $envFile = app()->environmentFilePath(); |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | |
| 169 | -if(!function_exists("cbLang")) { |
|
| 169 | +if (!function_exists("cbLang")) { |
|
| 170 | 170 | /** |
| 171 | 171 | * @param string $key |
| 172 | 172 | * @param array $replace |
@@ -178,17 +178,17 @@ discard block |
||
| 178 | 178 | } |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | -if(!function_exists('rglob')) { |
|
| 181 | +if (!function_exists('rglob')) { |
|
| 182 | 182 | function rglob($pattern, $flags = 0) { |
| 183 | 183 | $files = glob($pattern, $flags); |
| 184 | - foreach (glob(dirname($pattern).'/*', GLOB_ONLYDIR|GLOB_NOSORT) as $dir) { |
|
| 184 | + foreach (glob(dirname($pattern).'/*', GLOB_ONLYDIR | GLOB_NOSORT) as $dir) { |
|
| 185 | 185 | $files = array_merge($files, rglob($dir.'/'.basename($pattern), $flags)); |
| 186 | 186 | } |
| 187 | 187 | return $files; |
| 188 | 188 | } |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | -if(!function_exists('convertPHPToMomentFormat')) { |
|
| 191 | +if (!function_exists('convertPHPToMomentFormat')) { |
|
| 192 | 192 | function convertPHPToMomentFormat($format) |
| 193 | 193 | { |
| 194 | 194 | $replacements = [ |
@@ -235,13 +235,13 @@ discard block |
||
| 235 | 235 | } |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | -if(!function_exists('slug')) { |
|
| 238 | +if (!function_exists('slug')) { |
|
| 239 | 239 | function slug($string, $separator = '-') { |
| 240 | 240 | return \Illuminate\Support\Str::slug($string, $separator); |
| 241 | 241 | } |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | -if(!function_exists('columnSingleton')) { |
|
| 244 | +if (!function_exists('columnSingleton')) { |
|
| 245 | 245 | /** |
| 246 | 246 | * @return \crocodicstudio\crudbooster\controllers\scaffolding\singletons\ColumnSingleton |
| 247 | 247 | */ |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | } |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | -if(!function_exists('cbHook')) |
|
| 253 | +if (!function_exists('cbHook')) |
|
| 254 | 254 | { |
| 255 | 255 | /** |
| 256 | 256 | * @return crocodicstudio\crudbooster\hooks\CBHook |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | } |
| 263 | 263 | } |
| 264 | 264 | |
| 265 | -if(!function_exists('getTypeHook')) |
|
| 265 | +if (!function_exists('getTypeHook')) |
|
| 266 | 266 | { |
| 267 | 267 | /** |
| 268 | 268 | * @param string $type |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | } |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | -if(!function_exists('getPrimaryKey')) |
|
| 278 | +if (!function_exists('getPrimaryKey')) |
|
| 279 | 279 | { |
| 280 | 280 | function getPrimaryKey($table_name) |
| 281 | 281 | { |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | } |
| 284 | 284 | } |
| 285 | 285 | |
| 286 | -if(!function_exists('cb')) |
|
| 286 | +if (!function_exists('cb')) |
|
| 287 | 287 | { |
| 288 | 288 | function cb() |
| 289 | 289 | { |
@@ -291,25 +291,25 @@ discard block |
||
| 291 | 291 | } |
| 292 | 292 | } |
| 293 | 293 | |
| 294 | -if(!function_exists('cbAsset')) { |
|
| 294 | +if (!function_exists('cbAsset')) { |
|
| 295 | 295 | function cbAsset($path, $secure = null) { |
| 296 | 296 | return asset("cb_asset/".$path, $secure); |
| 297 | 297 | } |
| 298 | 298 | } |
| 299 | 299 | |
| 300 | -if(!function_exists("cbConfig")) { |
|
| 300 | +if (!function_exists("cbConfig")) { |
|
| 301 | 301 | function cbConfig($name, $default = null) { |
| 302 | 302 | return config("crudbooster.".$name, $default); |
| 303 | 303 | } |
| 304 | 304 | } |
| 305 | 305 | |
| 306 | -if(!function_exists("strRandom")) { |
|
| 306 | +if (!function_exists("strRandom")) { |
|
| 307 | 307 | function strRandom($length = 5) { |
| 308 | 308 | return \Illuminate\Support\Str::random($length); |
| 309 | 309 | } |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | -if(!function_exists('module')) { |
|
| 312 | +if (!function_exists('module')) { |
|
| 313 | 313 | function module() |
| 314 | 314 | { |
| 315 | 315 | $module = new \crocodicstudio\crudbooster\helpers\Module(); |
@@ -317,21 +317,21 @@ discard block |
||
| 317 | 317 | } |
| 318 | 318 | } |
| 319 | 319 | |
| 320 | -if(!function_exists('getAdminLoginURL')) { |
|
| 320 | +if (!function_exists('getAdminLoginURL')) { |
|
| 321 | 321 | function getAdminLoginURL() |
| 322 | 322 | { |
| 323 | 323 | return cb()->getAdminUrl("login"); |
| 324 | 324 | } |
| 325 | 325 | } |
| 326 | 326 | |
| 327 | -if(!function_exists('dummyPhoto')) { |
|
| 327 | +if (!function_exists('dummyPhoto')) { |
|
| 328 | 328 | function dummyPhoto() |
| 329 | 329 | { |
| 330 | 330 | return cbConfig("DUMMY_PHOTO"); |
| 331 | 331 | } |
| 332 | 332 | } |
| 333 | 333 | |
| 334 | -if(!function_exists('extract_unit')) { |
|
| 334 | +if (!function_exists('extract_unit')) { |
|
| 335 | 335 | /* |
| 336 | 336 | Credits: Bit Repository |
| 337 | 337 | URL: http://www.bitrepository.com/extract-content-between-two-delimiters-with-php.html |
@@ -356,14 +356,14 @@ discard block |
||
| 356 | 356 | | |
| 357 | 357 | */ |
| 358 | 358 | |
| 359 | -if(!function_exists('putSetting')) { |
|
| 359 | +if (!function_exists('putSetting')) { |
|
| 360 | 360 | function putSetting($key, $value) |
| 361 | 361 | { |
| 362 | - if(file_exists(storage_path('.cbconfig'))) { |
|
| 362 | + if (file_exists(storage_path('.cbconfig'))) { |
|
| 363 | 363 | $settings = file_get_contents(storage_path('.cbconfig')); |
| 364 | 364 | $settings = decrypt($settings); |
| 365 | 365 | $settings = unserialize($settings); |
| 366 | - }else{ |
|
| 366 | + } else { |
|
| 367 | 367 | $settings = []; |
| 368 | 368 | } |
| 369 | 369 | |
@@ -377,31 +377,31 @@ discard block |
||
| 377 | 377 | } |
| 378 | 378 | } |
| 379 | 379 | |
| 380 | -if(!function_exists('getSetting')) { |
|
| 380 | +if (!function_exists('getSetting')) { |
|
| 381 | 381 | function getSetting($key, $default = null) |
| 382 | 382 | { |
| 383 | - if($cache = \Illuminate\Support\Facades\Cache::get("setting_".$key)) { |
|
| 383 | + if ($cache = \Illuminate\Support\Facades\Cache::get("setting_".$key)) { |
|
| 384 | 384 | return $cache; |
| 385 | 385 | } |
| 386 | 386 | |
| 387 | - if(file_exists(storage_path('.cbconfig'))) { |
|
| 387 | + if (file_exists(storage_path('.cbconfig'))) { |
|
| 388 | 388 | $settings = file_get_contents(storage_path('.cbconfig')); |
| 389 | 389 | $settings = decrypt($settings); |
| 390 | 390 | $settings = unserialize($settings); |
| 391 | - }else{ |
|
| 391 | + } else { |
|
| 392 | 392 | $settings = []; |
| 393 | 393 | } |
| 394 | 394 | |
| 395 | - if(isset($settings[$key])) { |
|
| 395 | + if (isset($settings[$key])) { |
|
| 396 | 396 | \Illuminate\Support\Facades\Cache::forever("setting_".$key, $settings[$key]); |
| 397 | - return $settings[$key]?:$default; |
|
| 398 | - }else{ |
|
| 397 | + return $settings[$key] ?: $default; |
|
| 398 | + } else { |
|
| 399 | 399 | return $default; |
| 400 | 400 | } |
| 401 | 401 | } |
| 402 | 402 | } |
| 403 | 403 | |
| 404 | -if(!function_exists('timeAgo')) { |
|
| 404 | +if (!function_exists('timeAgo')) { |
|
| 405 | 405 | function timeAgo($datetime_to, $datetime_from = null, $full = false) |
| 406 | 406 | { |
| 407 | 407 | $datetime_from = ($datetime_from) ?: date('Y-m-d H:i:s'); |
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | } |
| 433 | 433 | } |
| 434 | 434 | |
| 435 | - if (! $full) { |
|
| 435 | + if (!$full) { |
|
| 436 | 436 | $string = array_slice($string, 0, 1); |
| 437 | 437 | } |
| 438 | 438 | |
@@ -440,22 +440,22 @@ discard block |
||
| 440 | 440 | } |
| 441 | 441 | } |
| 442 | 442 | |
| 443 | -if(!function_exists("array_map_r")) { |
|
| 444 | - function array_map_r( $func, $arr ) |
|
| 443 | +if (!function_exists("array_map_r")) { |
|
| 444 | + function array_map_r($func, $arr) |
|
| 445 | 445 | { |
| 446 | 446 | $newArr = array(); |
| 447 | 447 | |
| 448 | - foreach( $arr as $key => $value ) |
|
| 448 | + foreach ($arr as $key => $value) |
|
| 449 | 449 | { |
| 450 | 450 | $key = $func($key); |
| 451 | - $newArr[ $key ] = ( is_array( $value ) ? array_map_r( $func, $value ) : ( is_array($func) ? call_user_func_array($func, $value) : $func( $value ) ) ); |
|
| 451 | + $newArr[$key] = (is_array($value) ? array_map_r($func, $value) : (is_array($func) ? call_user_func_array($func, $value) : $func($value))); |
|
| 452 | 452 | } |
| 453 | 453 | |
| 454 | 454 | return $newArr; |
| 455 | 455 | } |
| 456 | 456 | } |
| 457 | 457 | |
| 458 | -if(!function_exists("sanitizeXSS")) |
|
| 458 | +if (!function_exists("sanitizeXSS")) |
|
| 459 | 459 | { |
| 460 | 460 | function sanitizeXSS($value) |
| 461 | 461 | { |
@@ -467,7 +467,7 @@ discard block |
||
| 467 | 467 | } |
| 468 | 468 | } |
| 469 | 469 | |
| 470 | -if(!function_exists("requestAll")) { |
|
| 470 | +if (!function_exists("requestAll")) { |
|
| 471 | 471 | function requestAll() { |
| 472 | 472 | $all = array_map_r("sanitizeXSS", request()->all()); |
| 473 | 473 | return $all; |
@@ -476,22 +476,22 @@ discard block |
||
| 476 | 476 | |
| 477 | 477 | |
| 478 | 478 | |
| 479 | -if(!function_exists('getURLFormat')) { |
|
| 479 | +if (!function_exists('getURLFormat')) { |
|
| 480 | 480 | function getURLFormat($name) { |
| 481 | 481 | $url = request($name); |
| 482 | - if(filter_var($url, FILTER_VALIDATE_URL)) { |
|
| 482 | + if (filter_var($url, FILTER_VALIDATE_URL)) { |
|
| 483 | 483 | return $url; |
| 484 | - }else{ |
|
| 484 | + } else { |
|
| 485 | 485 | return request()->url(); |
| 486 | 486 | } |
| 487 | 487 | } |
| 488 | 488 | } |
| 489 | 489 | |
| 490 | -if(!function_exists('g')) { |
|
| 490 | +if (!function_exists('g')) { |
|
| 491 | 491 | function g($name, $safe = true) { |
| 492 | - if($safe == true) { |
|
| 492 | + if ($safe == true) { |
|
| 493 | 493 | $response = request($name); |
| 494 | - if(is_string($response)) { |
|
| 494 | + if (is_string($response)) { |
|
| 495 | 495 | $response = sanitizeXSS($response); |
| 496 | 496 | }elseif (is_array($response)) { |
| 497 | 497 | array_walk_recursive($response, function(&$response) { |
@@ -500,25 +500,25 @@ discard block |
||
| 500 | 500 | } |
| 501 | 501 | |
| 502 | 502 | return $response; |
| 503 | - }else{ |
|
| 503 | + } else { |
|
| 504 | 504 | return Request::get($name); |
| 505 | 505 | } |
| 506 | 506 | } |
| 507 | 507 | } |
| 508 | 508 | |
| 509 | -if(!function_exists('min_var_export')) { |
|
| 509 | +if (!function_exists('min_var_export')) { |
|
| 510 | 510 | function min_var_export($input) { |
| 511 | - if(is_array($input)) { |
|
| 511 | + if (is_array($input)) { |
|
| 512 | 512 | $buffer = []; |
| 513 | - foreach($input as $key => $value) |
|
| 513 | + foreach ($input as $key => $value) |
|
| 514 | 514 | $buffer[] = var_export($key, true)."=>".min_var_export($value); |
| 515 | - return "[".implode(",",$buffer)."]"; |
|
| 515 | + return "[".implode(",", $buffer)."]"; |
|
| 516 | 516 | } else |
| 517 | 517 | return var_export($input, true); |
| 518 | 518 | } |
| 519 | 519 | } |
| 520 | 520 | |
| 521 | -if(!function_exists('rrmdir')) { |
|
| 521 | +if (!function_exists('rrmdir')) { |
|
| 522 | 522 | /* |
| 523 | 523 | * http://stackoverflow.com/questions/3338123/how-do-i-recursively-delete-a-directory-and-its-entire-contents-files-sub-dir |
| 524 | 524 | */ |
@@ -20,9 +20,9 @@ discard block |
||
| 20 | 20 | /* |
| 21 | 21 | * For security reason we have limit the upload file formats bellow |
| 22 | 22 | */ |
| 23 | - 'UPLOAD_FILE_EXTENSION_ALLOWED' => ['jpg','jpeg','png','gif','pdf','xls','xlsx','doc','docx','txt','zip','rar','rtf'], |
|
| 23 | + 'UPLOAD_FILE_EXTENSION_ALLOWED' => ['jpg', 'jpeg', 'png', 'gif', 'pdf', 'xls', 'xlsx', 'doc', 'docx', 'txt', 'zip', 'rar', 'rtf'], |
|
| 24 | 24 | |
| 25 | - 'UPLOAD_IMAGE_EXTENSION_ALLOWED' => ['jpg','jpeg','png','gif'], |
|
| 25 | + 'UPLOAD_IMAGE_EXTENSION_ALLOWED' => ['jpg', 'jpeg', 'png', 'gif'], |
|
| 26 | 26 | |
| 27 | 27 | /* |
| 28 | 28 | * Override Local FileSystem From Storage To Another |
@@ -58,5 +58,5 @@ discard block |
||
| 58 | 58 | * You can define in this array what the tables you want to include in "php artisan crudbooster:data_migration" |
| 59 | 59 | * The default is all cb_ prefix will be include in data migration |
| 60 | 60 | */ |
| 61 | - 'ADDITIONAL_DATA_MIGRATION'=>['users','migrations'] |
|
| 61 | + 'ADDITIONAL_DATA_MIGRATION'=>['users', 'migrations'] |
|
| 62 | 62 | ]; |
| 63 | 63 | \ No newline at end of file |
@@ -20,31 +20,31 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | public function getLogin() |
| 22 | 22 | { |
| 23 | - if(!auth()->guest()) return redirect(cb()->getAdminUrl()); |
|
| 23 | + if (!auth()->guest()) return redirect(cb()->getAdminUrl()); |
|
| 24 | 24 | |
| 25 | 25 | cbHook()->hookGetLogin(); |
| 26 | 26 | |
| 27 | 27 | $data = []; |
| 28 | - $data['no1'] = rand(1,10); |
|
| 29 | - $data['no2'] = rand(1,10); |
|
| 30 | - Session::put("captcha_result", $data['no1']+$data['no2']); |
|
| 28 | + $data['no1'] = rand(1, 10); |
|
| 29 | + $data['no2'] = rand(1, 10); |
|
| 30 | + Session::put("captcha_result", $data['no1'] + $data['no2']); |
|
| 31 | 31 | |
| 32 | 32 | $themeView = getThemePath("login"); |
| 33 | - $loginView = str_replace(".blade.php", "", getSetting('login_page_view',$themeView)); |
|
| 34 | - return view($loginView, $data ); |
|
| 33 | + $loginView = str_replace(".blade.php", "", getSetting('login_page_view', $themeView)); |
|
| 34 | + return view($loginView, $data); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | public function postLogin() |
| 38 | 38 | { |
| 39 | - try{ |
|
| 40 | - if($this->isSuspendedLogin()) throw new CBValidationException(cbLang("you_have_been_suspended")); |
|
| 39 | + try { |
|
| 40 | + if ($this->isSuspendedLogin()) throw new CBValidationException(cbLang("you_have_been_suspended")); |
|
| 41 | 41 | |
| 42 | 42 | cb()->validation([ |
| 43 | 43 | 'email'=>'required|email', |
| 44 | 44 | 'password'=>'required' |
| 45 | 45 | ]); |
| 46 | 46 | |
| 47 | - $credential = request()->only(['email','password']); |
|
| 47 | + $credential = request()->only(['email', 'password']); |
|
| 48 | 48 | if (auth()->attempt($credential)) { |
| 49 | 49 | |
| 50 | 50 | // When login user success, clear suspend attempt |
@@ -55,10 +55,10 @@ discard block |
||
| 55 | 55 | return redirect(cb()->getAdminUrl()); |
| 56 | 56 | } else { |
| 57 | 57 | $this->incrementFailedLogin(); |
| 58 | - return redirect(cb()->getLoginUrl())->with(['message'=>cbLang('password_and_username_is_wrong'),'message_type'=>'warning']); |
|
| 58 | + return redirect(cb()->getLoginUrl())->with(['message'=>cbLang('password_and_username_is_wrong'), 'message_type'=>'warning']); |
|
| 59 | 59 | } |
| 60 | - }catch (CBValidationException $e) { |
|
| 61 | - return cb()->redirect(cb()->getAdminUrl("login"),$e->getMessage(),'warning'); |
|
| 60 | + } catch (CBValidationException $e) { |
|
| 61 | + return cb()->redirect(cb()->getAdminUrl("login"), $e->getMessage(), 'warning'); |
|
| 62 | 62 | } |
| 63 | 63 | } |
| 64 | 64 | |