@@ -15,8 +15,8 @@ discard block |
||
| 15 | 15 | class CRUDBooster |
| 16 | 16 | { |
| 17 | 17 | /** |
| 18 | - * Comma-delimited data output from the child table |
|
| 19 | - */ |
|
| 18 | + * Comma-delimited data output from the child table |
|
| 19 | + */ |
|
| 20 | 20 | public static function echoSelect2Mult($values, $table, $id, $name) { |
| 21 | 21 | $values = explode(",", $values); |
| 22 | 22 | return implode(", ", DB::table($table)->whereIn($id, $values)->pluck($name)->toArray()); |
@@ -43,13 +43,13 @@ discard block |
||
| 43 | 43 | @$mime_type = $mime_type[1]; |
| 44 | 44 | if ($mime_type) { |
| 45 | 45 | $filePath = 'uploads/'.$userID.'/'.date('Y-m'); |
| 46 | - Storage::makeDirectory($filePath); |
|
| 47 | - $filename = md5(str_random(5)).'.'.$mime_type; |
|
| 48 | - if (Storage::put($filePath.'/'.$filename, $filedata)) { |
|
| 49 | - self::resizeImage($filePath.'/'.$filename); |
|
| 46 | + Storage::makeDirectory($filePath); |
|
| 47 | + $filename = md5(str_random(5)).'.'.$mime_type; |
|
| 48 | + if (Storage::put($filePath.'/'.$filename, $filedata)) { |
|
| 49 | + self::resizeImage($filePath.'/'.$filename); |
|
| 50 | 50 | |
| 51 | - return $filePath.'/'.$filename; |
|
| 52 | - } |
|
| 51 | + return $filePath.'/'.$filename; |
|
| 52 | + } |
|
| 53 | 53 | } |
| 54 | 54 | } |
| 55 | 55 | |
@@ -374,17 +374,17 @@ discard block |
||
| 374 | 374 | |
| 375 | 375 | public static function getCurrentModule() |
| 376 | 376 | { |
| 377 | - $modulepath = self::getModulePath(); |
|
| 377 | + $modulepath = self::getModulePath(); |
|
| 378 | 378 | |
| 379 | - if (Cache::has('moduls_'.$modulepath)) { |
|
| 380 | - return Cache::get('moduls_'.$modulepath); |
|
| 381 | - } else { |
|
| 379 | + if (Cache::has('moduls_'.$modulepath)) { |
|
| 380 | + return Cache::get('moduls_'.$modulepath); |
|
| 381 | + } else { |
|
| 382 | 382 | |
| 383 | - $module = DB::table('cms_moduls')->where('path', self::getModulePath())->first(); |
|
| 383 | + $module = DB::table('cms_moduls')->where('path', self::getModulePath())->first(); |
|
| 384 | 384 | |
| 385 | - //supply modulpath instead of $module incase where user decides to create form and custom url that does not exist in cms_moduls table. |
|
| 386 | - return ($module)?:$modulepath; |
|
| 387 | - } |
|
| 385 | + //supply modulpath instead of $module incase where user decides to create form and custom url that does not exist in cms_moduls table. |
|
| 386 | + return ($module)?:$modulepath; |
|
| 387 | + } |
|
| 388 | 388 | } |
| 389 | 389 | |
| 390 | 390 | public static function getCurrentDashboardId() |
@@ -526,22 +526,22 @@ discard block |
||
| 526 | 526 | |
| 527 | 527 | public static function getModulePath() |
| 528 | 528 | { |
| 529 | - // Check to position of admin_path |
|
| 530 | - if(config("crudbooster.ADMIN_PATH")) { |
|
| 531 | - $adminPathSegments = explode('/', Request::path()); |
|
| 532 | - $no = 1; |
|
| 533 | - foreach($adminPathSegments as $path) { |
|
| 534 | - if($path == config("crudbooster.ADMIN_PATH")) { |
|
| 535 | - $segment = $no+1; |
|
| 536 | - break; |
|
| 537 | - } |
|
| 538 | - $no++; |
|
| 539 | - } |
|
| 540 | - } else { |
|
| 541 | - $segment = 1; |
|
| 542 | - } |
|
| 543 | - |
|
| 544 | - return Request::segment($segment); |
|
| 529 | + // Check to position of admin_path |
|
| 530 | + if(config("crudbooster.ADMIN_PATH")) { |
|
| 531 | + $adminPathSegments = explode('/', Request::path()); |
|
| 532 | + $no = 1; |
|
| 533 | + foreach($adminPathSegments as $path) { |
|
| 534 | + if($path == config("crudbooster.ADMIN_PATH")) { |
|
| 535 | + $segment = $no+1; |
|
| 536 | + break; |
|
| 537 | + } |
|
| 538 | + $no++; |
|
| 539 | + } |
|
| 540 | + } else { |
|
| 541 | + $segment = 1; |
|
| 542 | + } |
|
| 543 | + |
|
| 544 | + return Request::segment($segment); |
|
| 545 | 545 | } |
| 546 | 546 | |
| 547 | 547 | public static function mainpath($path = null) |
@@ -937,19 +937,19 @@ discard block |
||
| 937 | 937 | // } |
| 938 | 938 | // } |
| 939 | 939 | |
| 940 | - public static function findPrimaryKey($table) |
|
| 941 | - { |
|
| 942 | - if(!$table) |
|
| 943 | - { |
|
| 944 | - return 'id'; |
|
| 945 | - } |
|
| 940 | + public static function findPrimaryKey($table) |
|
| 941 | + { |
|
| 942 | + if(!$table) |
|
| 943 | + { |
|
| 944 | + return 'id'; |
|
| 945 | + } |
|
| 946 | 946 | |
| 947 | - $pk = DB::getDoctrineSchemaManager()->listTableDetails($table)->getPrimaryKey(); |
|
| 948 | - if(!$pk) { |
|
| 949 | - return null; |
|
| 950 | - } |
|
| 951 | - return $pk->getColumns()[0]; |
|
| 952 | - } |
|
| 947 | + $pk = DB::getDoctrineSchemaManager()->listTableDetails($table)->getPrimaryKey(); |
|
| 948 | + if(!$pk) { |
|
| 949 | + return null; |
|
| 950 | + } |
|
| 951 | + return $pk->getColumns()[0]; |
|
| 952 | + } |
|
| 953 | 953 | |
| 954 | 954 | public static function newId($table) |
| 955 | 955 | { |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | public static function uploadBase64($value, $id = null) |
| 28 | 28 | { |
| 29 | - if (! self::myId()) { |
|
| 29 | + if (!self::myId()) { |
|
| 30 | 30 | $userID = 0; |
| 31 | 31 | } else { |
| 32 | 32 | $userID = self::myId(); |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | public static function uploadFile($name, $encrypt = false, $resize_width = null, $resize_height = null, $id = null) |
| 57 | 57 | { |
| 58 | 58 | if (Request::hasFile($name)) { |
| 59 | - if (! self::myId()) { |
|
| 59 | + if (!self::myId()) { |
|
| 60 | 60 | $userID = 0; |
| 61 | 61 | } else { |
| 62 | 62 | $userID = self::myId(); |
@@ -110,22 +110,22 @@ discard block |
||
| 110 | 110 | $img = Image::make(storage_path('app/'.$file_path.'/'.$filename)); |
| 111 | 111 | $img->fit($resize_width, $resize_height); |
| 112 | 112 | $img->save(storage_path('app/'.$file_path.'/'.$filename), $qty); |
| 113 | - } elseif ($resize_width && ! $resize_height) { |
|
| 113 | + } elseif ($resize_width && !$resize_height) { |
|
| 114 | 114 | $img = Image::make(storage_path('app/'.$file_path.'/'.$filename)); |
| 115 | - $img->resize($resize_width, null, function ($constraint) { |
|
| 115 | + $img->resize($resize_width, null, function($constraint) { |
|
| 116 | 116 | $constraint->aspectRatio(); |
| 117 | 117 | }); |
| 118 | 118 | $img->save(storage_path('app/'.$file_path.'/'.$filename), $qty); |
| 119 | - } elseif (! $resize_width && $resize_height) { |
|
| 119 | + } elseif (!$resize_width && $resize_height) { |
|
| 120 | 120 | $img = Image::make(storage_path('app/'.$file_path.'/'.$filename)); |
| 121 | - $img->resize(null, $resize_height, function ($constraint) { |
|
| 121 | + $img->resize(null, $resize_height, function($constraint) { |
|
| 122 | 122 | $constraint->aspectRatio(); |
| 123 | 123 | }); |
| 124 | 124 | $img->save(storage_path('app/'.$file_path.'/'.$filename), $qty); |
| 125 | 125 | } else { |
| 126 | 126 | $img = Image::make(storage_path('app/'.$file_path.'/'.$filename)); |
| 127 | 127 | if ($img->width() > 1300) { |
| 128 | - $img->resize(1300, null, function ($constraint) { |
|
| 128 | + $img->resize(1300, null, function($constraint) { |
|
| 129 | 129 | $constraint->aspectRatio(); |
| 130 | 130 | }); |
| 131 | 131 | } |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | public static function insert($table, $data = []) |
| 154 | 154 | { |
| 155 | 155 | $data['id'] = DB::table($table)->max('id') + 1; |
| 156 | - if (! $data['created_at']) { |
|
| 156 | + if (!$data['created_at']) { |
|
| 157 | 157 | if (Schema::hasColumn($table, 'created_at')) { |
| 158 | 158 | $data['created_at'] = date('Y-m-d H:i:s'); |
| 159 | 159 | } |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | $module = DB::table('cms_moduls')->where('path', self::getModulePath())->first(); |
| 384 | 384 | |
| 385 | 385 | //supply modulpath instead of $module incase where user decides to create form and custom url that does not exist in cms_moduls table. |
| 386 | - return ($module)?:$modulepath; |
|
| 386 | + return ($module) ?: $modulepath; |
|
| 387 | 387 | } |
| 388 | 388 | } |
| 389 | 389 | |
@@ -527,12 +527,12 @@ discard block |
||
| 527 | 527 | public static function getModulePath() |
| 528 | 528 | { |
| 529 | 529 | // Check to position of admin_path |
| 530 | - if(config("crudbooster.ADMIN_PATH")) { |
|
| 530 | + if (config("crudbooster.ADMIN_PATH")) { |
|
| 531 | 531 | $adminPathSegments = explode('/', Request::path()); |
| 532 | 532 | $no = 1; |
| 533 | - foreach($adminPathSegments as $path) { |
|
| 534 | - if($path == config("crudbooster.ADMIN_PATH")) { |
|
| 535 | - $segment = $no+1; |
|
| 533 | + foreach ($adminPathSegments as $path) { |
|
| 534 | + if ($path == config("crudbooster.ADMIN_PATH")) { |
|
| 535 | + $segment = $no + 1; |
|
| 536 | 536 | break; |
| 537 | 537 | } |
| 538 | 538 | $no++; |
@@ -570,7 +570,7 @@ discard block |
||
| 570 | 570 | { |
| 571 | 571 | $id = Session::get('current_row_id'); |
| 572 | 572 | $id = intval($id); |
| 573 | - $id = (! $id) ? Request::segment(4) : $id; |
|
| 573 | + $id = (!$id) ? Request::segment(4) : $id; |
|
| 574 | 574 | $id = intval($id); |
| 575 | 575 | |
| 576 | 576 | return $id; |
@@ -619,7 +619,7 @@ discard block |
||
| 619 | 619 | return Cache::get('field_type_'.$table.'_'.$field); |
| 620 | 620 | } |
| 621 | 621 | |
| 622 | - $typedata = Cache::rememberForever('field_type_'.$table.'_'.$field, function () use ($table, $field) { |
|
| 622 | + $typedata = Cache::rememberForever('field_type_'.$table.'_'.$field, function() use ($table, $field) { |
|
| 623 | 623 | |
| 624 | 624 | try { |
| 625 | 625 | //MySQL & SQL Server |
@@ -628,7 +628,7 @@ discard block |
||
| 628 | 628 | |
| 629 | 629 | } |
| 630 | 630 | |
| 631 | - if (! $typedata) { |
|
| 631 | + if (!$typedata) { |
|
| 632 | 632 | $typedata = 'varchar'; |
| 633 | 633 | } |
| 634 | 634 | |
@@ -705,7 +705,7 @@ discard block |
||
| 705 | 705 | } |
| 706 | 706 | } |
| 707 | 707 | |
| 708 | - if (! $full) { |
|
| 708 | + if (!$full) { |
|
| 709 | 709 | $string = array_slice($string, 0, 1); |
| 710 | 710 | } |
| 711 | 711 | |
@@ -728,7 +728,7 @@ discard block |
||
| 728 | 728 | $cc_email = $queue->email_cc_email; |
| 729 | 729 | $attachments = unserialize($queue->email_attachments); |
| 730 | 730 | |
| 731 | - \Mail::send("crudbooster::emails.blank", ['content' => $html], function ($message) use ( |
|
| 731 | + \Mail::send("crudbooster::emails.blank", ['content' => $html], function($message) use ( |
|
| 732 | 732 | $html, |
| 733 | 733 | $to, |
| 734 | 734 | $subject, |
@@ -790,7 +790,7 @@ discard block |
||
| 790 | 790 | return true; |
| 791 | 791 | } |
| 792 | 792 | |
| 793 | - \Mail::send("crudbooster::emails.blank", ['content' => $html], function ($message) use ($to, $subject, $template, $attachments) { |
|
| 793 | + \Mail::send("crudbooster::emails.blank", ['content' => $html], function($message) use ($to, $subject, $template, $attachments) { |
|
| 794 | 794 | $message->priority(1); |
| 795 | 795 | $message->to($to); |
| 796 | 796 | |
@@ -939,13 +939,13 @@ discard block |
||
| 939 | 939 | |
| 940 | 940 | public static function findPrimaryKey($table) |
| 941 | 941 | { |
| 942 | - if(!$table) |
|
| 942 | + if (!$table) |
|
| 943 | 943 | { |
| 944 | 944 | return 'id'; |
| 945 | 945 | } |
| 946 | 946 | |
| 947 | 947 | $pk = DB::getDoctrineSchemaManager()->listTableDetails($table)->getPrimaryKey(); |
| 948 | - if(!$pk) { |
|
| 948 | + if (!$pk) { |
|
| 949 | 949 | return null; |
| 950 | 950 | } |
| 951 | 951 | return $pk->getColumns()[0]; |
@@ -962,10 +962,10 @@ discard block |
||
| 962 | 962 | public static function isColumnExists($table, $field) |
| 963 | 963 | { |
| 964 | 964 | |
| 965 | - if (! $table) { |
|
| 965 | + if (!$table) { |
|
| 966 | 966 | throw new Exception("\$table is empty !", 1); |
| 967 | 967 | } |
| 968 | - if (! $field) { |
|
| 968 | + if (!$field) { |
|
| 969 | 969 | throw new Exception("\$field is empty !", 1); |
| 970 | 970 | } |
| 971 | 971 | |
@@ -1191,8 +1191,8 @@ discard block |
||
| 1191 | 1191 | |
| 1192 | 1192 | $sender_token = Request::header('X-Authorization-Token'); |
| 1193 | 1193 | |
| 1194 | - if (! Cache::has($sender_token)) { |
|
| 1195 | - if (! in_array($sender_token, $server_token)) { |
|
| 1194 | + if (!Cache::has($sender_token)) { |
|
| 1195 | + if (!in_array($sender_token, $server_token)) { |
|
| 1196 | 1196 | $result['api_status'] = false; |
| 1197 | 1197 | $result['api_message'] = "THE TOKEN IS NOT MATCH WITH SERVER TOKEN"; |
| 1198 | 1198 | $res = response()->json($result, 200); |
@@ -1239,7 +1239,7 @@ discard block |
||
| 1239 | 1239 | |
| 1240 | 1240 | public static function sendFCM($regID = [], $data) |
| 1241 | 1241 | { |
| 1242 | - if (! $data['title'] || ! $data['content']) { |
|
| 1242 | + if (!$data['title'] || !$data['content']) { |
|
| 1243 | 1243 | return 'title , content null !'; |
| 1244 | 1244 | } |
| 1245 | 1245 | |
@@ -1282,7 +1282,7 @@ discard block |
||
| 1282 | 1282 | $cols = collect(DB::select('SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = :database AND TABLE_NAME = :table', [ |
| 1283 | 1283 | 'database' => $table['database'], |
| 1284 | 1284 | 'table' => $table['table'], |
| 1285 | - ]))->map(function ($x) { |
|
| 1285 | + ]))->map(function($x) { |
|
| 1286 | 1286 | return (array) $x; |
| 1287 | 1287 | })->toArray(); |
| 1288 | 1288 | |
@@ -29,14 +29,14 @@ |
||
| 29 | 29 | |
| 30 | 30 | return redirect($url); |
| 31 | 31 | } |
| 32 | - if($request->url()==CRUDBooster::adminPath('')){ |
|
| 33 | - $menus=DB::table('cms_menus')->whereRaw("cms_menus.id IN (select id_cms_menus from cms_menus_privileges where id_cms_privileges = '".CRUDBooster::myPrivilegeId()."')")->where('is_dashboard', 1)->where('is_active', 1)->first(); |
|
| 32 | + if ($request->url() == CRUDBooster::adminPath('')) { |
|
| 33 | + $menus = DB::table('cms_menus')->whereRaw("cms_menus.id IN (select id_cms_menus from cms_menus_privileges where id_cms_privileges = '".CRUDBooster::myPrivilegeId()."')")->where('is_dashboard', 1)->where('is_active', 1)->first(); |
|
| 34 | 34 | if ($menus) { |
| 35 | 35 | if ($menus->type == 'Statistic') { |
| 36 | 36 | return redirect()->action('\crocodicstudio\crudbooster\controllers\StatisticBuilderController@getDashboard'); |
| 37 | 37 | } elseif ($menus->type == 'Module') { |
| 38 | 38 | $module = CRUDBooster::first('cms_moduls', ['path' => $menus->path]); |
| 39 | - return redirect()->action( $module->controller.'@getIndex'); |
|
| 39 | + return redirect()->action($module->controller.'@getIndex'); |
|
| 40 | 40 | } elseif ($menus->type == 'Route') { |
| 41 | 41 | $action = str_replace("Controller", "Controller@", $menus->path); |
| 42 | 42 | $action = str_replace(['Get', 'Post'], ['get', 'post'], $action); |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | /* ROUTER FOR API GENERATOR */ |
| 4 | 4 | $namespace = '\crocodicstudio\crudbooster\controllers'; |
| 5 | 5 | |
| 6 | -Route::group(['middleware' => ['api', '\crocodicstudio\crudbooster\middlewares\CBAuthAPI'], 'namespace' => 'App\Http\Controllers'], function () { |
|
| 6 | +Route::group(['middleware' => ['api', '\crocodicstudio\crudbooster\middlewares\CBAuthAPI'], 'namespace' => 'App\Http\Controllers'], function() { |
|
| 7 | 7 | //Router for custom api defeault |
| 8 | 8 | |
| 9 | 9 | $dir = scandir(base_path("app/Http/Controllers")); |
@@ -20,14 +20,14 @@ discard block |
||
| 20 | 20 | }); |
| 21 | 21 | |
| 22 | 22 | /* ROUTER FOR UPLOADS */ |
| 23 | -Route::group(['middleware' => ['web'], 'namespace' => $namespace], function () { |
|
| 23 | +Route::group(['middleware' => ['web'], 'namespace' => $namespace], function() { |
|
| 24 | 24 | Route::get('api-documentation', ['uses' => 'ApiCustomController@apiDocumentation', 'as' => 'apiDocumentation']); |
| 25 | 25 | Route::get('download-documentation-postman', ['uses' => 'ApiCustomController@getDownloadPostman', 'as' => 'downloadDocumentationPostman']); |
| 26 | 26 | Route::get('uploads/{one?}/{two?}/{three?}/{four?}/{five?}', ['uses' => 'FileController@getPreview', 'as' => 'fileControllerPreview']); |
| 27 | 27 | }); |
| 28 | 28 | |
| 29 | 29 | /* ROUTER FOR WEB */ |
| 30 | -Route::group(['middleware' => ['web'], 'prefix' => config('crudbooster.ADMIN_PATH'), 'namespace' => $namespace], function () { |
|
| 30 | +Route::group(['middleware' => ['web'], 'prefix' => config('crudbooster.ADMIN_PATH'), 'namespace' => $namespace], function() { |
|
| 31 | 31 | |
| 32 | 32 | Route::post('unlock-screen', ['uses' => 'AdminController@postUnlockScreen', 'as' => 'postUnlockScreen']); |
| 33 | 33 | Route::get('lock-screen', ['uses' => 'AdminController@getLockscreen', 'as' => 'getLockScreen']); |
@@ -45,9 +45,9 @@ discard block |
||
| 45 | 45 | 'middleware' => ['web', '\crocodicstudio\crudbooster\middlewares\CBBackend'], |
| 46 | 46 | 'prefix' => config('crudbooster.ADMIN_PATH'), |
| 47 | 47 | 'namespace' => 'App\Http\Controllers', |
| 48 | -], function () use ($namespace) { |
|
| 48 | +], function() use ($namespace) { |
|
| 49 | 49 | |
| 50 | - Route::get('/',function () { |
|
| 50 | + Route::get('/', function() { |
|
| 51 | 51 | }); |
| 52 | 52 | try { |
| 53 | 53 | $moduls = DB::table('cms_moduls')->where('path', '!=', '')->where('controller', '!=', '') |
@@ -65,12 +65,12 @@ discard block |
||
| 65 | 65 | 'middleware' => ['web', '\crocodicstudio\crudbooster\middlewares\CBBackend'], |
| 66 | 66 | 'prefix' => config('crudbooster.ADMIN_PATH'), |
| 67 | 67 | 'namespace' => $namespace, |
| 68 | -], function () { |
|
| 68 | +], function() { |
|
| 69 | 69 | |
| 70 | 70 | /* DO NOT EDIT THESE BELLOW LINES */ |
| 71 | 71 | if (Request::is(config('crudbooster.ADMIN_PATH'))) { |
| 72 | 72 | $menus = DB::table('cms_menus')->where('is_dashboard', 1)->first(); |
| 73 | - if (! $menus) { |
|
| 73 | + if (!$menus) { |
|
| 74 | 74 | CRUDBooster::routeController('/', 'AdminController', $namespace = '\crocodicstudio\crudbooster\controllers'); |
| 75 | 75 | } |
| 76 | 76 | } |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | $this->cbLoader(); |
| 241 | 241 | |
| 242 | 242 | $module = CRUDBooster::getCurrentModule(); |
| 243 | - if (! CRUDBooster::isView() && $this->global_privilege == false) { |
|
| 243 | + if (!CRUDBooster::isView() && $this->global_privilege == false) { |
|
| 244 | 244 | CRUDBooster::insertLog(trans('crudbooster.log_try_view', ['module' => $module->name])); |
| 245 | 245 | CRUDBooster::redirect(CRUDBooster::adminPath(), trans('crudbooster.denied_access')); |
| 246 | 246 | } |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | |
| 278 | 278 | public function hook_before_add(&$postdata) |
| 279 | 279 | { |
| 280 | - if (! $postdata['id_cms_privileges']) { |
|
| 280 | + if (!$postdata['id_cms_privileges']) { |
|
| 281 | 281 | $postdata['id_cms_privileges'] = CRUDBooster::myPrivilegeId(); |
| 282 | 282 | } |
| 283 | 283 | $postdata['parent_id'] = 0; |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | |
| 214 | 214 | $module = CRUDBooster::getCurrentModule(); |
| 215 | 215 | |
| 216 | - if (! CRUDBooster::isView() && $this->global_privilege == false) { |
|
| 216 | + if (!CRUDBooster::isView() && $this->global_privilege == false) { |
|
| 217 | 217 | CRUDBooster::insertLog(trans('crudbooster.log_try_view', ['module' => $module->name])); |
| 218 | 218 | CRUDBooster::redirect(CRUDBooster::adminPath(), trans('crudbooster.denied_access')); |
| 219 | 219 | } |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | $field = @$coltab['name']; |
| 273 | 273 | $join_table_temp[] = $table; |
| 274 | 274 | |
| 275 | - if (! $field) { |
|
| 275 | + if (!$field) { |
|
| 276 | 276 | continue; |
| 277 | 277 | } |
| 278 | 278 | |
@@ -358,12 +358,12 @@ discard block |
||
| 358 | 358 | } |
| 359 | 359 | } else { |
| 360 | 360 | |
| 361 | - if(isset($field_array[1])) { |
|
| 361 | + if (isset($field_array[1])) { |
|
| 362 | 362 | $result->addselect($table.'.'.$field.' as '.$table.'_'.$field); |
| 363 | 363 | $columns_table[$index]['type_data'] = CRUDBooster::getFieldType($table, $field); |
| 364 | 364 | $columns_table[$index]['field'] = $table.'_'.$field; |
| 365 | 365 | $columns_table[$index]['field_raw'] = $table.'.'.$field; |
| 366 | - }else{ |
|
| 366 | + } else { |
|
| 367 | 367 | $result->addselect($table.'.'.$field); |
| 368 | 368 | $columns_table[$index]['type_data'] = CRUDBooster::getFieldType($table, $field); |
| 369 | 369 | $columns_table[$index]['field'] = $field; |
@@ -375,9 +375,9 @@ discard block |
||
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | if (Request::get('q')) { |
| 378 | - $result->where(function ($w) use ($columns_table, $request) { |
|
| 378 | + $result->where(function($w) use ($columns_table, $request) { |
|
| 379 | 379 | foreach ($columns_table as $col) { |
| 380 | - if (! $col['field_with']) { |
|
| 380 | + if (!$col['field_with']) { |
|
| 381 | 381 | continue; |
| 382 | 382 | } |
| 383 | 383 | if ($col['is_subquery']) { |
@@ -398,7 +398,7 @@ discard block |
||
| 398 | 398 | if (Request::get('filter_column')) { |
| 399 | 399 | |
| 400 | 400 | $filter_column = Request::get('filter_column'); |
| 401 | - $result->where(function ($w) use ($filter_column, $fc) { |
|
| 401 | + $result->where(function($w) use ($filter_column, $fc) { |
|
| 402 | 402 | foreach ($filter_column as $key => $fc) { |
| 403 | 403 | |
| 404 | 404 | $value = @$fc['value']; |
@@ -514,7 +514,7 @@ discard block |
||
| 514 | 514 | $addaction[] = [ |
| 515 | 515 | 'label' => $s['label'], |
| 516 | 516 | 'icon' => $s['button_icon'], |
| 517 | - 'url' => CRUDBooster::adminPath($s['path']).'?return_url='.urlencode(Request::fullUrl()).'&parent_table='.$table_parent.'&parent_columns='.$s['parent_columns'].'&parent_columns_alias='.$s['parent_columns_alias'].'&parent_id=['.(! isset($s['custom_parent_id']) ? "id" : $s['custom_parent_id']).']&foreign_key='.$s['foreign_key'].'&label='.urlencode($s['label']), |
|
| 517 | + 'url' => CRUDBooster::adminPath($s['path']).'?return_url='.urlencode(Request::fullUrl()).'&parent_table='.$table_parent.'&parent_columns='.$s['parent_columns'].'&parent_columns_alias='.$s['parent_columns_alias'].'&parent_id=['.(!isset($s['custom_parent_id']) ? "id" : $s['custom_parent_id']).']&foreign_key='.$s['foreign_key'].'&label='.urlencode($s['label']), |
|
| 518 | 518 | 'color' => $s['button_color'], |
| 519 | 519 | 'showIf' => $s['showIf'], |
| 520 | 520 | ]; |
@@ -611,7 +611,7 @@ discard block |
||
| 611 | 611 | $button_action_style = $this->button_action_style; |
| 612 | 612 | $html_content[] = "<div class='button_action' style='text-align:right'>".view('crudbooster::components.action', compact('addaction', 'row', 'button_action_style', 'parent_field'))->render()."</div>"; |
| 613 | 613 | |
| 614 | - endif;//button_table_action |
|
| 614 | + endif; //button_table_action |
|
| 615 | 615 | |
| 616 | 616 | foreach ($html_content as $i => $v) { |
| 617 | 617 | $this->hook_row_index($i, $v); |
@@ -661,18 +661,18 @@ discard block |
||
| 661 | 661 | return $pdf->stream($filename.'.pdf'); |
| 662 | 662 | break; |
| 663 | 663 | case 'xls': |
| 664 | - Excel::create($filename, function ($excel) use ($response) { |
|
| 664 | + Excel::create($filename, function($excel) use ($response) { |
|
| 665 | 665 | $excel->setTitle($filename)->setCreator("crudbooster.com")->setCompany(CRUDBooster::getSetting('appname')); |
| 666 | - $excel->sheet($filename, function ($sheet) use ($response) { |
|
| 666 | + $excel->sheet($filename, function($sheet) use ($response) { |
|
| 667 | 667 | $sheet->setOrientation($paperorientation); |
| 668 | 668 | $sheet->loadview('crudbooster::export', $response); |
| 669 | 669 | }); |
| 670 | 670 | })->export('xls'); |
| 671 | 671 | break; |
| 672 | 672 | case 'csv': |
| 673 | - Excel::create($filename, function ($excel) use ($response) { |
|
| 673 | + Excel::create($filename, function($excel) use ($response) { |
|
| 674 | 674 | $excel->setTitle($filename)->setCreator("crudbooster.com")->setCompany(CRUDBooster::getSetting('appname')); |
| 675 | - $excel->sheet($filename, function ($sheet) use ($response) { |
|
| 675 | + $excel->sheet($filename, function($sheet) use ($response) { |
|
| 676 | 676 | $sheet->setOrientation($paperorientation); |
| 677 | 677 | $sheet->loadview('crudbooster::export', $response); |
| 678 | 678 | }); |
@@ -724,7 +724,7 @@ discard block |
||
| 724 | 724 | $result = DB::table($table); |
| 725 | 725 | |
| 726 | 726 | if (Request::get('q')) { |
| 727 | - $result->where(function ($where) use ($columns) { |
|
| 727 | + $result->where(function($where) use ($columns) { |
|
| 728 | 728 | foreach ($columns as $c => $col) { |
| 729 | 729 | if ($c == 0) { |
| 730 | 730 | $where->where($col, 'like', '%'.Request::get('q').'%'); |
@@ -863,7 +863,7 @@ discard block |
||
| 863 | 863 | $ai = []; |
| 864 | 864 | $name = $di['name']; |
| 865 | 865 | |
| 866 | - if (! isset($request_all[$name])) { |
|
| 866 | + if (!isset($request_all[$name])) { |
|
| 867 | 867 | continue; |
| 868 | 868 | } |
| 869 | 869 | |
@@ -895,7 +895,7 @@ discard block |
||
| 895 | 895 | $ai[] = 'mimes:'.$di['mimes']; |
| 896 | 896 | } |
| 897 | 897 | $name = $di['name']; |
| 898 | - if (! $name) { |
|
| 898 | + if (!$name) { |
|
| 899 | 899 | continue; |
| 900 | 900 | } |
| 901 | 901 | |
@@ -997,7 +997,7 @@ discard block |
||
| 997 | 997 | foreach ($this->data_inputan as $ro) { |
| 998 | 998 | $name = $ro['name']; |
| 999 | 999 | |
| 1000 | - if (! $name) { |
|
| 1000 | + if (!$name) { |
|
| 1001 | 1001 | continue; |
| 1002 | 1002 | } |
| 1003 | 1003 | |
@@ -1047,7 +1047,7 @@ discard block |
||
| 1047 | 1047 | |
| 1048 | 1048 | $password_candidate = explode(',', config('crudbooster.PASSWORD_FIELDS_CANDIDATE')); |
| 1049 | 1049 | if (in_array($name, $password_candidate)) { |
| 1050 | - if (! empty($this->arr[$name])) { |
|
| 1050 | + if (!empty($this->arr[$name])) { |
|
| 1051 | 1051 | $this->arr[$name] = Hash::make($this->arr[$name]); |
| 1052 | 1052 | } else { |
| 1053 | 1053 | unset($this->arr[$name]); |
@@ -1073,7 +1073,7 @@ discard block |
||
| 1073 | 1073 | if ($ro['type'] == 'multitext') { |
| 1074 | 1074 | $name = $ro['name']; |
| 1075 | 1075 | $multitext = ""; |
| 1076 | - $maxI = ($this->arr[$name])?count($this->arr[$name]):0; |
|
| 1076 | + $maxI = ($this->arr[$name]) ?count($this->arr[$name]) : 0; |
|
| 1077 | 1077 | for ($i = 0; $i <= $maxI - 1; $i++) { |
| 1078 | 1078 | $multitext .= $this->arr[$name][$i]."|"; |
| 1079 | 1079 | } |
@@ -1102,7 +1102,7 @@ discard block |
||
| 1102 | 1102 | |
| 1103 | 1103 | $this->arr[$name] = CRUDBooster::uploadFile($name, $ro['encrypt'] || $ro['upload_encrypt'], $ro['resize_width'], $ro['resize_height'], CB::myId()); |
| 1104 | 1104 | |
| 1105 | - if (! $this->arr[$name]) { |
|
| 1105 | + if (!$this->arr[$name]) { |
|
| 1106 | 1106 | $this->arr[$name] = Request::get('_'.$name); |
| 1107 | 1107 | } |
| 1108 | 1108 | } |
@@ -1118,7 +1118,7 @@ discard block |
||
| 1118 | 1118 | public function getAdd() |
| 1119 | 1119 | { |
| 1120 | 1120 | $this->cbLoader(); |
| 1121 | - if (! CRUDBooster::isCreate() && $this->global_privilege == false || $this->button_add == false) { |
|
| 1121 | + if (!CRUDBooster::isCreate() && $this->global_privilege == false || $this->button_add == false) { |
|
| 1122 | 1122 | CRUDBooster::insertLog(trans('crudbooster.log_try_add', ['module' => CRUDBooster::getCurrentModule()->name])); |
| 1123 | 1123 | CRUDBooster::redirect(CRUDBooster::adminPath(), trans("crudbooster.denied_access")); |
| 1124 | 1124 | } |
@@ -1133,7 +1133,7 @@ discard block |
||
| 1133 | 1133 | public function postAddSave() |
| 1134 | 1134 | { |
| 1135 | 1135 | $this->cbLoader(); |
| 1136 | - if (! CRUDBooster::isCreate() && $this->global_privilege == false) { |
|
| 1136 | + if (!CRUDBooster::isCreate() && $this->global_privilege == false) { |
|
| 1137 | 1137 | CRUDBooster::insertLog(trans('crudbooster.log_try_add_save', [ |
| 1138 | 1138 | 'name' => Request::input($this->title_field), |
| 1139 | 1139 | 'module' => CRUDBooster::getCurrentModule()->name, |
@@ -1154,13 +1154,13 @@ discard block |
||
| 1154 | 1154 | $lastInsertId = $id = DB::table($this->table)->insertGetId($this->arr); |
| 1155 | 1155 | |
| 1156 | 1156 | //fix bug if primary key is uuid |
| 1157 | - if($this->arr[$this->primary_key]!=$id) |
|
| 1157 | + if ($this->arr[$this->primary_key] != $id) |
|
| 1158 | 1158 | $id = $this->arr[$this->primary_key]; |
| 1159 | 1159 | |
| 1160 | 1160 | //Looping Data Input Again After Insert |
| 1161 | 1161 | foreach ($this->data_inputan as $ro) { |
| 1162 | 1162 | $name = $ro['name']; |
| 1163 | - if (! $name) { |
|
| 1163 | + if (!$name) { |
|
| 1164 | 1164 | continue; |
| 1165 | 1165 | } |
| 1166 | 1166 | |
@@ -1211,7 +1211,7 @@ discard block |
||
| 1211 | 1211 | $name = str_slug($ro['label'], ''); |
| 1212 | 1212 | $columns = $ro['columns']; |
| 1213 | 1213 | $getColName = Request::get($name.'-'.$columns[0]['name']); |
| 1214 | - $count_input_data = ($getColName)?(count($getColName) - 1):0; |
|
| 1214 | + $count_input_data = ($getColName) ? (count($getColName) - 1) : 0; |
|
| 1215 | 1215 | $child_array = []; |
| 1216 | 1216 | $fk = $ro['foreign_key']; |
| 1217 | 1217 | |
@@ -1220,11 +1220,11 @@ discard block |
||
| 1220 | 1220 | foreach ($columns as $col) { |
| 1221 | 1221 | $colname = $col['name']; |
| 1222 | 1222 | $colvalue = Request::get($name.'-'.$colname)[$i]; |
| 1223 | - if(isset($colvalue) === TRUE) { |
|
| 1223 | + if (isset($colvalue) === TRUE) { |
|
| 1224 | 1224 | $column_data[$colname] = $colvalue; |
| 1225 | 1225 | } |
| 1226 | 1226 | } |
| 1227 | - if(isset($column_data) === TRUE) { |
|
| 1227 | + if (isset($column_data) === TRUE) { |
|
| 1228 | 1228 | $column_data[$fk] = (!empty($id) ? $id : $lastInsertId); |
| 1229 | 1229 | $child_array[] = $column_data; |
| 1230 | 1230 | } |
@@ -1262,7 +1262,7 @@ discard block |
||
| 1262 | 1262 | $this->cbLoader(); |
| 1263 | 1263 | $row = DB::table($this->table)->where($this->primary_key, $id)->first(); |
| 1264 | 1264 | |
| 1265 | - if (! CRUDBooster::isRead() && $this->global_privilege == false || $this->button_edit == false) { |
|
| 1265 | + if (!CRUDBooster::isRead() && $this->global_privilege == false || $this->button_edit == false) { |
|
| 1266 | 1266 | CRUDBooster::insertLog(trans("crudbooster.log_try_edit", [ |
| 1267 | 1267 | 'name' => $row->{$this->title_field}, |
| 1268 | 1268 | 'module' => CRUDBooster::getCurrentModule()->name, |
@@ -1283,7 +1283,7 @@ discard block |
||
| 1283 | 1283 | $this->cbLoader(); |
| 1284 | 1284 | $row = DB::table($this->table)->where($this->primary_key, $id)->first(); |
| 1285 | 1285 | |
| 1286 | - if (! CRUDBooster::isUpdate() && $this->global_privilege == false) { |
|
| 1286 | + if (!CRUDBooster::isUpdate() && $this->global_privilege == false) { |
|
| 1287 | 1287 | CRUDBooster::insertLog(trans("crudbooster.log_try_add", ['name' => $row->{$this->title_field}, 'module' => CRUDBooster::getCurrentModule()->name])); |
| 1288 | 1288 | CRUDBooster::redirect(CRUDBooster::adminPath(), trans('crudbooster.denied_access')); |
| 1289 | 1289 | } |
@@ -1301,7 +1301,7 @@ discard block |
||
| 1301 | 1301 | //Looping Data Input Again After Insert |
| 1302 | 1302 | foreach ($this->data_inputan as $ro) { |
| 1303 | 1303 | $name = $ro['name']; |
| 1304 | - if (! $name) { |
|
| 1304 | + if (!$name) { |
|
| 1305 | 1305 | continue; |
| 1306 | 1306 | } |
| 1307 | 1307 | |
@@ -1350,8 +1350,8 @@ discard block |
||
| 1350 | 1350 | } |
| 1351 | 1351 | if ($ro['relationship_table'] && $ro["datatable_orig"] != "") { |
| 1352 | 1352 | $params = explode("|", $ro['datatable_orig']); |
| 1353 | - if(!isset($params[2])) $params[2] = "id"; |
|
| 1354 | - DB::table($params[0])->where($params[2], $id)->update([$params[1] => implode(",",$inputdata)]); |
|
| 1353 | + if (!isset($params[2])) $params[2] = "id"; |
|
| 1354 | + DB::table($params[0])->where($params[2], $id)->update([$params[1] => implode(",", $inputdata)]); |
|
| 1355 | 1355 | } |
| 1356 | 1356 | } |
| 1357 | 1357 | |
@@ -1359,7 +1359,7 @@ discard block |
||
| 1359 | 1359 | $name = str_slug($ro['label'], ''); |
| 1360 | 1360 | $columns = $ro['columns']; |
| 1361 | 1361 | $getColName = Request::get($name.'-'.$columns[0]['name']); |
| 1362 | - $count_input_data = ($getColName)?(count($getColName) - 1):0; |
|
| 1362 | + $count_input_data = ($getColName) ? (count($getColName) - 1) : 0; |
|
| 1363 | 1363 | $child_array = []; |
| 1364 | 1364 | $childtable = CRUDBooster::parseSqlTable($ro['table'])['table']; |
| 1365 | 1365 | $fk = $ro['foreign_key']; |
@@ -1373,11 +1373,11 @@ discard block |
||
| 1373 | 1373 | foreach ($columns as $col) { |
| 1374 | 1374 | $colname = $col['name']; |
| 1375 | 1375 | $colvalue = Request::get($name.'-'.$colname)[$i]; |
| 1376 | - if(isset($colvalue) === TRUE) { |
|
| 1376 | + if (isset($colvalue) === TRUE) { |
|
| 1377 | 1377 | $column_data[$colname] = $colvalue; |
| 1378 | 1378 | } |
| 1379 | 1379 | } |
| 1380 | - if(isset($column_data) === TRUE){ |
|
| 1380 | + if (isset($column_data) === TRUE) { |
|
| 1381 | 1381 | $column_data[$childtablePK] = $lastId; |
| 1382 | 1382 | $column_data[$fk] = $id; |
| 1383 | 1383 | $child_array[] = $column_data; |
@@ -1416,7 +1416,7 @@ discard block |
||
| 1416 | 1416 | $this->cbLoader(); |
| 1417 | 1417 | $row = DB::table($this->table)->where($this->primary_key, $id)->first(); |
| 1418 | 1418 | |
| 1419 | - if (! CRUDBooster::isDelete() && $this->global_privilege == false || $this->button_delete == false) { |
|
| 1419 | + if (!CRUDBooster::isDelete() && $this->global_privilege == false || $this->button_delete == false) { |
|
| 1420 | 1420 | CRUDBooster::insertLog(trans("crudbooster.log_try_delete", [ |
| 1421 | 1421 | 'name' => $row->{$this->title_field}, |
| 1422 | 1422 | 'module' => CRUDBooster::getCurrentModule()->name, |
@@ -1447,7 +1447,7 @@ discard block |
||
| 1447 | 1447 | $this->cbLoader(); |
| 1448 | 1448 | $row = DB::table($this->table)->where($this->primary_key, $id)->first(); |
| 1449 | 1449 | |
| 1450 | - if (! CRUDBooster::isRead() && $this->global_privilege == false || $this->button_detail == false) { |
|
| 1450 | + if (!CRUDBooster::isRead() && $this->global_privilege == false || $this->button_detail == false) { |
|
| 1451 | 1451 | CRUDBooster::insertLog(trans("crudbooster.log_try_view", [ |
| 1452 | 1452 | 'name' => $row->{$this->title_field}, |
| 1453 | 1453 | 'module' => CRUDBooster::getCurrentModule()->name, |
@@ -1472,13 +1472,13 @@ discard block |
||
| 1472 | 1472 | $data['page_menu'] = Route::getCurrentRoute()->getActionName(); |
| 1473 | 1473 | $data['page_title'] = 'Import Data '.$module->name; |
| 1474 | 1474 | |
| 1475 | - if (Request::get('file') && ! Request::get('import')) { |
|
| 1475 | + if (Request::get('file') && !Request::get('import')) { |
|
| 1476 | 1476 | $file = base64_decode(Request::get('file')); |
| 1477 | 1477 | $file = storage_path('app/'.$file); |
| 1478 | - $rows = Excel::load($file, function ($reader) { |
|
| 1478 | + $rows = Excel::load($file, function($reader) { |
|
| 1479 | 1479 | })->get(); |
| 1480 | 1480 | |
| 1481 | - $countRows = ($rows)?count($rows):0; |
|
| 1481 | + $countRows = ($rows) ?count($rows) : 0; |
|
| 1482 | 1482 | |
| 1483 | 1483 | Session::put('total_data_import', $countRows); |
| 1484 | 1484 | |
@@ -1536,7 +1536,7 @@ discard block |
||
| 1536 | 1536 | $file = base64_decode(Request::get('file')); |
| 1537 | 1537 | $file = storage_path('app/'.$file); |
| 1538 | 1538 | |
| 1539 | - $rows = Excel::load($file, function ($reader) { |
|
| 1539 | + $rows = Excel::load($file, function($reader) { |
|
| 1540 | 1540 | })->get(); |
| 1541 | 1541 | |
| 1542 | 1542 | $has_created_at = false; |
@@ -1564,7 +1564,7 @@ discard block |
||
| 1564 | 1564 | $relation_moduls = DB::table('cms_moduls')->where('table_name', $relation_table)->first(); |
| 1565 | 1565 | |
| 1566 | 1566 | $relation_class = __NAMESPACE__.'\\'.$relation_moduls->controller; |
| 1567 | - if (! class_exists($relation_class)) { |
|
| 1567 | + if (!class_exists($relation_class)) { |
|
| 1568 | 1568 | $relation_class = '\App\Http\Controllers\\'.$relation_moduls->controller; |
| 1569 | 1569 | } |
| 1570 | 1570 | $relation_class = new $relation_class; |
@@ -1671,12 +1671,12 @@ discard block |
||
| 1671 | 1671 | $id_selected = Request::input('checkbox'); |
| 1672 | 1672 | $button_name = Request::input('button_name'); |
| 1673 | 1673 | |
| 1674 | - if (! $id_selected) { |
|
| 1674 | + if (!$id_selected) { |
|
| 1675 | 1675 | CRUDBooster::redirect($_SERVER['HTTP_REFERER'], trans("crudbooster.alert_select_a_data"), 'warning'); |
| 1676 | 1676 | } |
| 1677 | 1677 | |
| 1678 | 1678 | if ($button_name == 'delete') { |
| 1679 | - if (! CRUDBooster::isDelete()) { |
|
| 1679 | + if (!CRUDBooster::isDelete()) { |
|
| 1680 | 1680 | CRUDBooster::insertLog(trans("crudbooster.log_try_delete_selected", ['module' => CRUDBooster::getCurrentModule()->name])); |
| 1681 | 1681 | CRUDBooster::redirect(CRUDBooster::adminPath(), trans('crudbooster.denied_access')); |
| 1682 | 1682 | } |
@@ -1704,8 +1704,8 @@ discard block |
||
| 1704 | 1704 | $message = trans("crudbooster.alert_action", ['action' => $action]); |
| 1705 | 1705 | |
| 1706 | 1706 | if ($this->actionButtonSelected($id_selected, $button_name) === false) { |
| 1707 | - $message = ! empty($this->alert['message']) ? $this->alert['message'] : 'Error'; |
|
| 1708 | - $type = ! empty($this->alert['type']) ? $this->alert['type'] : 'danger'; |
|
| 1707 | + $message = !empty($this->alert['message']) ? $this->alert['message'] : 'Error'; |
|
| 1708 | + $type = !empty($this->alert['type']) ? $this->alert['type'] : 'danger'; |
|
| 1709 | 1709 | } |
| 1710 | 1710 | |
| 1711 | 1711 | return redirect()->back()->with(['message_type' => $type, 'message' => $message]); |
@@ -1719,7 +1719,7 @@ discard block |
||
| 1719 | 1719 | |
| 1720 | 1720 | $row = DB::table($this->table)->where($this->primary_key, $id)->first(); |
| 1721 | 1721 | |
| 1722 | - if (! CRUDBooster::isDelete() && $this->global_privilege == false) { |
|
| 1722 | + if (!CRUDBooster::isDelete() && $this->global_privilege == false) { |
|
| 1723 | 1723 | CRUDBooster::insertLog(trans("crudbooster.log_try_delete_image", [ |
| 1724 | 1724 | 'name' => $row->{$this->title_field}, |
| 1725 | 1725 | 'module' => CRUDBooster::getCurrentModule()->name, |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | $columns_table[$index]['type_data'] = CRUDBooster::getFieldType($table, $field); |
| 364 | 364 | $columns_table[$index]['field'] = $table.'_'.$field; |
| 365 | 365 | $columns_table[$index]['field_raw'] = $table.'.'.$field; |
| 366 | - }else{ |
|
| 366 | + } else{ |
|
| 367 | 367 | $result->addselect($table.'.'.$field); |
| 368 | 368 | $columns_table[$index]['type_data'] = CRUDBooster::getFieldType($table, $field); |
| 369 | 369 | $columns_table[$index]['field'] = $field; |
@@ -1154,8 +1154,9 @@ discard block |
||
| 1154 | 1154 | $lastInsertId = $id = DB::table($this->table)->insertGetId($this->arr); |
| 1155 | 1155 | |
| 1156 | 1156 | //fix bug if primary key is uuid |
| 1157 | - if($this->arr[$this->primary_key]!=$id) |
|
| 1158 | - $id = $this->arr[$this->primary_key]; |
|
| 1157 | + if($this->arr[$this->primary_key]!=$id) { |
|
| 1158 | + $id = $this->arr[$this->primary_key]; |
|
| 1159 | + } |
|
| 1159 | 1160 | |
| 1160 | 1161 | //Looping Data Input Again After Insert |
| 1161 | 1162 | foreach ($this->data_inputan as $ro) { |
@@ -1350,7 +1351,9 @@ discard block |
||
| 1350 | 1351 | } |
| 1351 | 1352 | if ($ro['relationship_table'] && $ro["datatable_orig"] != "") { |
| 1352 | 1353 | $params = explode("|", $ro['datatable_orig']); |
| 1353 | - if(!isset($params[2])) $params[2] = "id"; |
|
| 1354 | + if(!isset($params[2])) { |
|
| 1355 | + $params[2] = "id"; |
|
| 1356 | + } |
|
| 1354 | 1357 | DB::table($params[0])->where($params[2], $id)->update([$params[1] => implode(",",$inputdata)]); |
| 1355 | 1358 | } |
| 1356 | 1359 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | { |
| 66 | 66 | $this->cbLoader(); |
| 67 | 67 | |
| 68 | - $menus= DB::table('cms_menus')->whereRaw("cms_menus.id IN (select id_cms_menus from cms_menus_privileges where id_cms_privileges = '".CRUDBooster::myPrivilegeId()."')")->where('is_dashboard', 1)->where('is_active', 1)->first(); |
|
| 68 | + $menus = DB::table('cms_menus')->whereRaw("cms_menus.id IN (select id_cms_menus from cms_menus_privileges where id_cms_privileges = '".CRUDBooster::myPrivilegeId()."')")->where('is_dashboard', 1)->where('is_active', 1)->first(); |
|
| 69 | 69 | |
| 70 | 70 | $slug = str_replace("statistic_builder/show/", "", $menus->path); |
| 71 | 71 | |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | { |
| 91 | 91 | $this->cbLoader(); |
| 92 | 92 | |
| 93 | - if (! CRUDBooster::isSuperadmin()) { |
|
| 93 | + if (!CRUDBooster::isSuperadmin()) { |
|
| 94 | 94 | CRUDBooster::insertLog(trans("crudbooster.log_try_view", ['name' => 'Builder', 'module' => 'Statistic'])); |
| 95 | 95 | CRUDBooster::redirect(CRUDBooster::adminPath(), trans('crudbooster.denied_access')); |
| 96 | 96 | } |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | { |
| 171 | 171 | $this->cbLoader(); |
| 172 | 172 | |
| 173 | - if (! CRUDBooster::isSuperadmin()) { |
|
| 173 | + if (!CRUDBooster::isSuperadmin()) { |
|
| 174 | 174 | CRUDBooster::insertLog(trans("crudbooster.log_try_view", ['name' => 'Edit Component', 'module' => 'Statistic'])); |
| 175 | 175 | CRUDBooster::redirect(CRUDBooster::adminPath(), trans('crudbooster.denied_access')); |
| 176 | 176 | } |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | |
| 197 | 197 | public function getDeleteComponent($id) |
| 198 | 198 | { |
| 199 | - if (! CRUDBooster::isSuperadmin()) { |
|
| 199 | + if (!CRUDBooster::isSuperadmin()) { |
|
| 200 | 200 | CRUDBooster::insertLog(trans("crudbooster.log_try_view", ['name' => 'Delete Component', 'module' => 'Statistic'])); |
| 201 | 201 | CRUDBooster::redirect(CRUDBooster::adminPath(), trans('crudbooster.denied_access')); |
| 202 | 202 | } |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | </tr> |
| 448 | 448 | </thead> |
| 449 | 449 | <tbody> |
| 450 | - <?php $index = 0;?> |
|
| 450 | + <?php $index = 0; ?> |
|
| 451 | 451 | @foreach($cb_form as $form) |
| 452 | 452 | <tr> |
| 453 | 453 | <td><input type='text' value='{{$form["label"]}}' placeholder="Input field label" onclick='showColumnSuggest(this)' |
@@ -476,7 +476,7 @@ discard block |
||
| 476 | 476 | $types = file_get_contents($types); |
| 477 | 477 | $types = json_decode($types); |
| 478 | 478 | |
| 479 | - if($types): |
|
| 479 | + if ($types): |
|
| 480 | 480 | ?> |
| 481 | 481 | |
| 482 | 482 | @if($types->alert) |
@@ -486,12 +486,12 @@ discard block |
||
| 486 | 486 | @endif |
| 487 | 487 | |
| 488 | 488 | <?php |
| 489 | - if($types->attribute->required): |
|
| 490 | - foreach($types->attribute->required as $key=>$val): |
|
| 489 | + if ($types->attribute->required): |
|
| 490 | + foreach ($types->attribute->required as $key=>$val): |
|
| 491 | 491 | @$value = $form[$key]; |
| 492 | - if(is_object($val)): |
|
| 492 | + if (is_object($val)): |
|
| 493 | 493 | |
| 494 | - if($val->type && $val->type == 'radio'): |
|
| 494 | + if ($val->type && $val->type == 'radio'): |
|
| 495 | 495 | ?> |
| 496 | 496 | <div class="form-group"> |
| 497 | 497 | <label>{{$key}}</label> |
@@ -509,7 +509,7 @@ discard block |
||
| 509 | 509 | <input type="text" name="option[{{$index}}][{{$key}}]" placeholder="{{$val->placeholder}}" value="{{$value}}" |
| 510 | 510 | class="form-control"> |
| 511 | 511 | </div> |
| 512 | - <?php endif;?> |
|
| 512 | + <?php endif; ?> |
|
| 513 | 513 | <?php else:?> |
| 514 | 514 | |
| 515 | 515 | <div class="form-group"> |
@@ -517,25 +517,25 @@ discard block |
||
| 517 | 517 | <input type="text" name="option[{{$index}}][{{$key}}]" placeholder="{{$val}}" value="{{$value}}" class="form-control"> |
| 518 | 518 | </div> |
| 519 | 519 | |
| 520 | - <?php endif;?> |
|
| 521 | - <?php endforeach; endif;?> |
|
| 520 | + <?php endif; ?> |
|
| 521 | + <?php endforeach; endif; ?> |
|
| 522 | 522 | |
| 523 | 523 | |
| 524 | 524 | |
| 525 | 525 | <?php |
| 526 | - if($types->attribute->requiredOne): |
|
| 527 | - foreach($types->attribute->requiredOne as $key=>$val): |
|
| 526 | + if ($types->attribute->requiredOne): |
|
| 527 | + foreach ($types->attribute->requiredOne as $key=>$val): |
|
| 528 | 528 | @$value = $form[$key]; |
| 529 | 529 | ?> |
| 530 | 530 | <div class="form-group"> |
| 531 | 531 | <label>{{$key}}</label> |
| 532 | 532 | <input type="text" name="option[{{$index}}][{{$key}}]" placeholder="{{$val}}" value="{{$value}}" class="form-control"> |
| 533 | 533 | </div> |
| 534 | - <?php endforeach; endif;?> |
|
| 534 | + <?php endforeach; endif; ?> |
|
| 535 | 535 | |
| 536 | 536 | <?php |
| 537 | - if($types->attribute->optional): |
|
| 538 | - foreach($types->attribute->optional as $key=>$val): |
|
| 537 | + if ($types->attribute->optional): |
|
| 538 | + foreach ($types->attribute->optional as $key=>$val): |
|
| 539 | 539 | @$value = $form[$key]; |
| 540 | 540 | |
| 541 | 541 | ?> |
@@ -549,10 +549,10 @@ discard block |
||
| 549 | 549 | class="form-control"> |
| 550 | 550 | @endif |
| 551 | 551 | </div> |
| 552 | - <?php endforeach; endif;?> |
|
| 552 | + <?php endforeach; endif; ?> |
|
| 553 | 553 | |
| 554 | 554 | |
| 555 | - <?php endif;?> |
|
| 555 | + <?php endif; ?> |
|
| 556 | 556 | </div> |
| 557 | 557 | </td> |
| 558 | 558 | <td> |
@@ -562,7 +562,7 @@ discard block |
||
| 562 | 562 | <a href="javascript:void(0)" class="btn btn-success btn-down"><i class='fa fa-arrow-down'></i></a> |
| 563 | 563 | </td> |
| 564 | 564 | </tr> |
| 565 | - <?php $index++;?> |
|
| 565 | + <?php $index++; ?> |
|
| 566 | 566 | @endforeach |
| 567 | 567 | |
| 568 | 568 | <tr id='tr-sample' style="display: none"> |
@@ -502,22 +502,28 @@ |
||
| 502 | 502 | |
| 503 | 503 | </div> |
| 504 | 504 | |
| 505 | - <?php else:?> |
|
| 505 | + <?php else { |
|
| 506 | + :?> |
|
| 506 | 507 | |
| 507 | 508 | <div class="form-group"> |
| 508 | 509 | <label>{{$key}}</label> |
| 509 | 510 | <input type="text" name="option[{{$index}}][{{$key}}]" placeholder="{{$val->placeholder}}" value="{{$value}}" |
| 510 | 511 | class="form-control"> |
| 511 | 512 | </div> |
| 512 | - <?php endif;?> |
|
| 513 | - <?php else:?> |
|
| 513 | + <?php endif; |
|
| 514 | +} |
|
| 515 | +?> |
|
| 516 | + <?php else { |
|
| 517 | + :?> |
|
| 514 | 518 | |
| 515 | 519 | <div class="form-group"> |
| 516 | 520 | <label>{{$key}}</label> |
| 517 | 521 | <input type="text" name="option[{{$index}}][{{$key}}]" placeholder="{{$val}}" value="{{$value}}" class="form-control"> |
| 518 | 522 | </div> |
| 519 | 523 | |
| 520 | - <?php endif;?> |
|
| 524 | + <?php endif; |
|
| 525 | +} |
|
| 526 | +?> |
|
| 521 | 527 | <?php endforeach; endif;?> |
| 522 | 528 | |
| 523 | 529 | |