@@ -24,15 +24,15 @@ discard block |
||
| 24 | 24 | { |
| 25 | 25 | $this->cbLoader(); |
| 26 | 26 | |
| 27 | - $columns = array_filter(\Schema::getColumnListing($table), function ($colName) { |
|
| 28 | - return ! (in_array($colName, ['created_at', 'deleted_at', 'updated_at'])); |
|
| 27 | + $columns = array_filter(\Schema::getColumnListing($table), function($colName) { |
|
| 28 | + return !(in_array($colName, ['created_at', 'deleted_at', 'updated_at'])); |
|
| 29 | 29 | }); |
| 30 | 30 | |
| 31 | 31 | $result = []; |
| 32 | 32 | foreach ($columns as $colName) { |
| 33 | 33 | $result[] = ['name' => $colName, 'type' => $this->getFieldType($colName, $table)]; |
| 34 | 34 | |
| 35 | - if (! in_array($type, ['list', 'detail']) || ! starts_with($colName, 'id_')) { |
|
| 35 | + if (!in_array($type, ['list', 'detail']) || !starts_with($colName, 'id_')) { |
|
| 36 | 36 | continue; |
| 37 | 37 | } |
| 38 | 38 | $relatedTable = str_after($colName, 'id_'); |
@@ -73,8 +73,8 @@ discard block |
||
| 73 | 73 | private function addRelatedTableColTypes($table, $result) |
| 74 | 74 | { |
| 75 | 75 | $columns = DB::getSchemaBuilder()->getColumnListing($table); |
| 76 | - $columns = array_filter($columns, function ($col) { |
|
| 77 | - return ! FieldDetector::isExceptional($col) && !starts_with($col, 'id_'); |
|
| 76 | + $columns = array_filter($columns, function($col) { |
|
| 77 | + return !FieldDetector::isExceptional($col) && !starts_with($col, 'id_'); |
|
| 78 | 78 | }); |
| 79 | 79 | |
| 80 | 80 | foreach ($columns as $col) { |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | public function validateForImport($file) |
| 69 | 69 | { |
| 70 | - return Validator::make(['extension' => $file->getClientOriginalExtension(),], ['extension' => 'in:xls,xlsx,csv']); |
|
| 70 | + return Validator::make(['extension' => $file->getClientOriginalExtension(), ], ['extension' => 'in:xls,xlsx,csv']); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | /** |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | $file = base64_decode(request('file')); |
| 84 | 84 | $file = 'storage'.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.$file; |
| 85 | - $rows = Excel::load($file, function ($reader) { |
|
| 85 | + $rows = Excel::load($file, function($reader) { |
|
| 86 | 86 | })->get(); |
| 87 | 87 | |
| 88 | 88 | //$data_import_column = []; |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | foreach ($selectColumn as $sk => $s) { |
| 128 | 128 | $colname = $table_columns[$sk]; |
| 129 | 129 | |
| 130 | - if (! DbInspector::isForeignKey($colname) || intval($value->$s)) { |
|
| 130 | + if (!DbInspector::isForeignKey($colname) || intval($value->$s)) { |
|
| 131 | 131 | $a[$colname] = $value->$s; |
| 132 | 132 | continue; |
| 133 | 133 | } |
@@ -175,10 +175,10 @@ discard block |
||
| 175 | 175 | { |
| 176 | 176 | $module = ModulesRepo::getByTableName($table); |
| 177 | 177 | if (is_null($module)) { |
| 178 | - return ; |
|
| 178 | + return; |
|
| 179 | 179 | } |
| 180 | 180 | $relation_class = __NAMESPACE__.'\\'.$module->controller; |
| 181 | - if (! class_exists($relation_class)) { |
|
| 181 | + if (!class_exists($relation_class)) { |
|
| 182 | 182 | $relation_class = ctrlNamespace().'\\'.$module->controller; |
| 183 | 183 | } |
| 184 | 184 | |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | public static function getCurrentModule() |
| 25 | 25 | { |
| 26 | 26 | $modulepath = self::getModulePath(); |
| 27 | - return cache()->remember('crudbooster_modules_'.$modulepath, 2, function () use ($modulepath) { |
|
| 27 | + return cache()->remember('crudbooster_modules_'.$modulepath, 2, function() use ($modulepath) { |
|
| 28 | 28 | return ModulesRepo::getByPath($modulepath); |
| 29 | 29 | }); |
| 30 | 30 | } |
@@ -25,8 +25,8 @@ discard block |
||
| 25 | 25 | $this->checkLaravelVersion(); |
| 26 | 26 | $this->checkPHPversion(); |
| 27 | 27 | |
| 28 | - $extensions = ['mbstring', 'openssl', 'pdo', 'tokenizer', 'xml', 'gd', 'fileinfo',]; |
|
| 29 | - array_walk($extensions, function ($ext){ |
|
| 28 | + $extensions = ['mbstring', 'openssl', 'pdo', 'tokenizer', 'xml', 'gd', 'fileinfo', ]; |
|
| 29 | + array_walk($extensions, function($ext) { |
|
| 30 | 30 | $this->chechExtension($ext); |
| 31 | 31 | }); |
| 32 | 32 | |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | private function chechExtension($extension) |
| 76 | 76 | { |
| 77 | - if (! extension_loaded($extension)) { |
|
| 77 | + if (!extension_loaded($extension)) { |
|
| 78 | 78 | $this->console->info($extension.' extension: [Bad]'); |
| 79 | 79 | return $this->requirements = false; |
| 80 | 80 | } |
@@ -44,7 +44,7 @@ |
||
| 44 | 44 | { |
| 45 | 45 | $ctrl->hookValidate(); |
| 46 | 46 | |
| 47 | - if (! $ctrl->validate) { |
|
| 47 | + if (!$ctrl->validate) { |
|
| 48 | 48 | return true; |
| 49 | 49 | } // hook have to return true |
| 50 | 50 | //todo : translation |
@@ -149,7 +149,7 @@ |
||
| 149 | 149 | protected function genericLoader() |
| 150 | 150 | { |
| 151 | 151 | $this->cbInit(); |
| 152 | - $this->primaryKey = $this->primaryKey?: DbInspector::findPk($this->table); |
|
| 152 | + $this->primaryKey = $this->primaryKey ?: DbInspector::findPk($this->table); |
|
| 153 | 153 | $this->data_inputan = $this->form; |
| 154 | 154 | $this->data['pk'] = $this->primaryKey; |
| 155 | 155 | $this->data['hide_form'] = $this->hide_form; |
@@ -44,13 +44,13 @@ discard block |
||
| 44 | 44 | { |
| 45 | 45 | $path = request('path') ? base64_decode(request('path')) : 'uploads'; |
| 46 | 46 | $file = Request::file('userfile'); |
| 47 | - if (! $file) { |
|
| 47 | + if (!$file) { |
|
| 48 | 48 | return null; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | $fileName = $file->getClientOriginalName(); |
| 52 | 52 | |
| 53 | - if (! FieldDetector::isUploadField($file->getClientOriginalExtension())) { |
|
| 53 | + if (!FieldDetector::isUploadField($file->getClientOriginalExtension())) { |
|
| 54 | 54 | backWithMsg('The file '.$fileName.' type is not allowed!', 'warning'); |
| 55 | 55 | } |
| 56 | 56 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | public function getDeleteFile($file) |
| 71 | 71 | { |
| 72 | 72 | $file = base64_decode($file); |
| 73 | - if(Storage::delete($file)) |
|
| 73 | + if (Storage::delete($file)) |
|
| 74 | 74 | backWithMsg('The file has been deleted!'); |
| 75 | 75 | |
| 76 | 76 | backWithMsg('The file did not deleted!', 'warning'); |
@@ -70,8 +70,9 @@ |
||
| 70 | 70 | public function getDeleteFile($file) |
| 71 | 71 | { |
| 72 | 72 | $file = base64_decode($file); |
| 73 | - if(Storage::delete($file)) |
|
| 74 | - backWithMsg('The file has been deleted!'); |
|
| 73 | + if(Storage::delete($file)) { |
|
| 74 | + backWithMsg('The file has been deleted!'); |
|
| 75 | + } |
|
| 75 | 76 | |
| 76 | 77 | backWithMsg('The file did not deleted!', 'warning'); |
| 77 | 78 | } |
@@ -15,11 +15,11 @@ discard block |
||
| 15 | 15 | */ |
| 16 | 16 | public static function findPK(string $table): string |
| 17 | 17 | { |
| 18 | - if (! $table) { |
|
| 18 | + if (!$table) { |
|
| 19 | 19 | return 'id'; |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | - return cache()->remember('CrudBooster_pk_'.$table, 10, function () use ($table) { |
|
| 22 | + return cache()->remember('CrudBooster_pk_'.$table, 10, function() use ($table) { |
|
| 23 | 23 | return self::findPKname($table) ?: 'id'; |
| 24 | 24 | }); |
| 25 | 25 | } |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | private static function findPKname($table) |
| 32 | 32 | { |
| 33 | 33 | $cols = \DB::getDoctrineSchemaManager()->listTableDetails($table)->getPrimaryKey()->getColumns(); |
| 34 | - if (! empty($cols)) { |
|
| 34 | + if (!empty($cols)) { |
|
| 35 | 35 | return $cols[0]; |
| 36 | 36 | } |
| 37 | 37 | } |
@@ -44,11 +44,11 @@ discard block |
||
| 44 | 44 | public static function isNullableColumn($table, $colName) |
| 45 | 45 | { |
| 46 | 46 | $colObj = \DB::getDoctrineSchemaManager()->listTableColumns($table)[$colName]; |
| 47 | - if (! $colObj) { |
|
| 47 | + if (!$colObj) { |
|
| 48 | 48 | return; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - return ! $colObj->getNotnull(); |
|
| 51 | + return !$colObj->getNotnull(); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | /** |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | */ |
| 77 | 77 | public static function isForeignKey($fieldName) |
| 78 | 78 | { |
| 79 | - return Cache::rememberForever('crudbooster_isForeignKey_'.$fieldName, function () use ($fieldName) { |
|
| 79 | + return Cache::rememberForever('crudbooster_isForeignKey_'.$fieldName, function() use ($fieldName) { |
|
| 80 | 80 | $table = self::getRelatedTableName($fieldName); |
| 81 | 81 | return ($table && Schema::hasTable($table)); |
| 82 | 82 | }); |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | CbRouter::routeController($module->path, $module->controller); |
| 22 | 22 | } |
| 23 | 23 | } catch (Exception $e) { |
| 24 | - dd($e); |
|
| 24 | + dd($e); |
|
| 25 | 25 | } |
| 26 | 26 | }); |
| 27 | 27 | |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | $namespace = cbControllersNS(); |
| 6 | 6 | /* ROUTER FOR UPLOADS */ |
| 7 | -Route::group(['middleware' => ['web'], 'namespace' => $namespace], function () { |
|
| 7 | +Route::group(['middleware' => ['web'], 'namespace' => $namespace], function() { |
|
| 8 | 8 | Route::get('uploads/{one?}/{two?}/{three?}/{four?}/{five?}', ['uses' => 'FileController@getPreview', 'as' => 'fileControllerPreview']); |
| 9 | 9 | }); |
| 10 | 10 | |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | 'middleware' => ['web', \crocodicstudio\crudbooster\CBCoreModule\middlewares\CBBackend::class], |
| 14 | 14 | 'prefix' => cbAdminPath(), |
| 15 | 15 | 'namespace' => ctrlNamespace(), |
| 16 | -], function () { |
|
| 16 | +], function() { |
|
| 17 | 17 | try { |
| 18 | 18 | $argv = request()->server('argv'); |
| 19 | 19 | if (is_array($argv) && isset($argv[1]) && !starts_with($argv[1], 'route:')) { |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | 'middleware' => ['web', \crocodicstudio\crudbooster\CBCoreModule\middlewares\CBSuperadmin::class], |
| 34 | 34 | 'prefix' => cbAdminPath(), |
| 35 | 35 | 'namespace' => $namespace, |
| 36 | -], function () { |
|
| 36 | +], function() { |
|
| 37 | 37 | Route::post('{module}/do-upload-import-data', 'FileController@uploadImportData')->name('UploadImportData'); |
| 38 | 38 | Route::post('{module}/upload-summernote', 'FileController@uploadSummernote')->name('UploadImportData'); |
| 39 | 39 | Route::post('{module}/upload-file', 'FileController@uploadFile')->name('UploadImportData'); |