@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | public function boot() |
15 | 15 | { |
16 | - $this->loadRoutesFrom( __DIR__.'/logs_routes.php'); |
|
16 | + $this->loadRoutesFrom(__DIR__.'/logs_routes.php'); |
|
17 | 17 | $this->publishes([__DIR__.'/localization' => resource_path('lang')], 'cb_localization'); |
18 | 18 | } |
19 | 19 |
@@ -14,7 +14,7 @@ |
||
14 | 14 | public function boot() |
15 | 15 | { |
16 | 16 | $this->app['view']->addNamespace('CbPrivilege', __DIR__.'/views'); |
17 | - $this->loadRoutesFrom( __DIR__.'/privileges_routes.php'); |
|
17 | + $this->loadRoutesFrom(__DIR__.'/privileges_routes.php'); |
|
18 | 18 | $this->publishes([__DIR__.'/localization' => resource_path('lang')], 'cb_localization'); |
19 | 19 | } |
20 | 20 |
@@ -53,16 +53,16 @@ discard block |
||
53 | 53 | __DIR__.'/userfiles/views/vendor/crudbooster/type_components/readme.txt' => resource_path('views/vendor/crudbooster/type_components/readme.txt'), |
54 | 54 | ], 'cb_type_components'); |
55 | 55 | |
56 | - if (! file_exists(app_path('Http/Controllers/CBHook.php'))) { |
|
56 | + if (!file_exists(app_path('Http/Controllers/CBHook.php'))) { |
|
57 | 57 | $this->publishes([__DIR__.'/userfiles/controllers/CBHook.php' => app_path('Http/Controllers/CBHook.php')], 'CBHook'); |
58 | 58 | } |
59 | 59 | |
60 | - if (! file_exists(app_path('Http/Controllers/AdminUsersController.php'))) { |
|
60 | + if (!file_exists(app_path('Http/Controllers/AdminUsersController.php'))) { |
|
61 | 61 | $this->publishes([__DIR__.'/userfiles/controllers/AdminUsersController.php' => app_path('Http/Controllers/AdminUsersController.php')], 'cb_user_controller'); |
62 | 62 | } |
63 | 63 | |
64 | 64 | $this->defineValidationRules(); |
65 | - $this->loadRoutesFrom( __DIR__.'/routes.php'); |
|
65 | + $this->loadRoutesFrom(__DIR__.'/routes.php'); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | { |
75 | 75 | $this->mergeConfigFrom(__DIR__.'/configs/crudbooster.php', 'crudbooster'); |
76 | 76 | |
77 | - $this->app->singleton('crudbooster', function () { |
|
77 | + $this->app->singleton('crudbooster', function() { |
|
78 | 78 | return true; |
79 | 79 | }); |
80 | 80 | |
@@ -116,14 +116,14 @@ discard block |
||
116 | 116 | |
117 | 117 | private function registerCrudboosterCommand() |
118 | 118 | { |
119 | - $this->app->singleton('crudboosterinstall', function () { |
|
119 | + $this->app->singleton('crudboosterinstall', function() { |
|
120 | 120 | return new CrudboosterInstallationCommand; |
121 | 121 | }); |
122 | 122 | } |
123 | 123 | |
124 | 124 | private function defineValidationRules() |
125 | 125 | { |
126 | - \Validator::extend('alpha_spaces', function ($attribute, $value) { |
|
126 | + \Validator::extend('alpha_spaces', function($attribute, $value) { |
|
127 | 127 | // This will only accept alpha and spaces. |
128 | 128 | // If you want to accept hyphens use: /^[\pL\s-]+$/u. |
129 | 129 | return preg_match('/^[\pL\s]+$/u', $value); |
@@ -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'); |
@@ -28,11 +28,11 @@ discard block |
||
28 | 28 | public function createVendorAtPublic() |
29 | 29 | { |
30 | 30 | $this->console->info('Checking public/vendor directory...'); |
31 | - if (! file_exists(public_path('vendor'))) { |
|
31 | + if (!file_exists(public_path('vendor'))) { |
|
32 | 32 | mkdir(public_path('vendor'), 0777); |
33 | 33 | } |
34 | 34 | |
35 | - if (! is_writable(public_path('vendor'))) { |
|
35 | + if (!is_writable(public_path('vendor'))) { |
|
36 | 36 | $this->console->info('Setup aborted !'); |
37 | 37 | $this->console->info('Please set public/vendor directory to writable 0777'); |
38 | 38 | exit; |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | public function symlinkForUpload() |
43 | 43 | { |
44 | 44 | $this->console->info('Checking public/uploads symlink...'); |
45 | - if (! file_exists(public_path('uploads'))) { |
|
45 | + if (!file_exists(public_path('uploads'))) { |
|
46 | 46 | $this->console->info('Creating public/uploads symlink...'); |
47 | 47 | app('files')->link(storage_path('app'), public_path('uploads')); |
48 | 48 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | |
60 | 60 | private function rrmdir($dir) |
61 | 61 | { |
62 | - if (! is_dir($dir)) { |
|
62 | + if (!is_dir($dir)) { |
|
63 | 63 | return; |
64 | 64 | } |
65 | 65 | foreach (scandir($dir) as $object) { |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | |
85 | 85 | $vendorPath = public_path('vendor'.DIRECTORY_SEPARATOR.'crudbooster'); |
86 | 86 | $ds = DIRECTORY_SEPARATOR; |
87 | - if (! file_exists($vendorPath)) { |
|
87 | + if (!file_exists($vendorPath)) { |
|
88 | 88 | $this->console->info('Creating public/vendor/crudbooster symlink...'); |
89 | 89 | app('files')->link(base_path('vendor'.$ds.'crocodicstudio'.$ds.'crudbooster'.$ds.'src'.$ds.'assets'), public_path('vendor/crudbooster')); |
90 | 90 | |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | $this->console->info('Migrating database...'); |
117 | 117 | $this->console->call('migrate', ['--path' => '\database\migrations\crudbooster']); |
118 | 118 | |
119 | - if (! class_exists('CBSeeder')) { |
|
119 | + if (!class_exists('CBSeeder')) { |
|
120 | 120 | $ds = DIRECTORY_SEPARATOR; |
121 | 121 | base_path('vendor'.$ds.'crocodicstudio'.$ds.'crudbooster'.$ds.'src'.$ds.'database'.$ds.'seeds'.$ds.'CBSeeder.php'); |
122 | 122 | } |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | |
6 | 6 | $namespace = cbControllersNS(); |
7 | 7 | /* ROUTER FOR UPLOADS */ |
8 | -Route::group(['middleware' => ['web'], 'namespace' => $namespace], function () { |
|
8 | +Route::group(['middleware' => ['web'], 'namespace' => $namespace], function() { |
|
9 | 9 | Route::get('uploads/{one?}/{two?}/{three?}/{four?}/{five?}', ['uses' => 'FileController@getPreview', 'as' => 'fileControllerPreview']); |
10 | 10 | }); |
11 | 11 | |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | 'middleware' => ['web', CBBackend::class], |
15 | 15 | 'prefix' => cbAdminPath(), |
16 | 16 | 'namespace' => ctrlNamespace(), |
17 | -], function () { |
|
17 | +], function() { |
|
18 | 18 | try { |
19 | 19 | $modules = DB::table('cms_moduls')->where('path', '!=', '')->where('controller', '!=', '')->where('is_protected', 0)->get(); |
20 | 20 | foreach ($modules as $module) { |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | 'middleware' => ['web', \crocodicstudio\crudbooster\middlewares\CBSuperadmin::class], |
31 | 31 | 'prefix' => cbAdminPath(), |
32 | 32 | 'namespace' => $namespace, |
33 | -], function () { |
|
33 | +], function() { |
|
34 | 34 | Route::post('{module}/do-upload-import-data', 'FileController@uploadImportData')->name('UploadImportData'); |
35 | 35 | Route::post('{module}/upload-summernote', 'FileController@uploadSummernote')->name('UploadImportData'); |
36 | 36 | Route::post('{module}/upload-file', 'FileController@uploadFile')->name('UploadImportData'); |
@@ -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 | }); |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | } |
61 | 61 | ApiResponder::send($result, $posts, $this->ctrl); |
62 | 62 | } elseif (in_array($actionType, ['save_add', 'save_edit'])) { |
63 | - $rowAssign = array_filter($input_validator, function ($column) use ($table) { |
|
63 | + $rowAssign = array_filter($input_validator, function($column) use ($table) { |
|
64 | 64 | return Schema::hasColumn($table, $column); |
65 | 65 | }, ARRAY_FILTER_USE_KEY); |
66 | 66 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | */ |
114 | 114 | private function filterRows($data, $parameters, $posts, $table, $typeExcept) |
115 | 115 | { |
116 | - $data->where(function ($w) use ($parameters, $posts, $table, $typeExcept) { |
|
116 | + $data->where(function($w) use ($parameters, $posts, $table, $typeExcept) { |
|
117 | 117 | foreach ($parameters as $param) { |
118 | 118 | $name = $param['name']; |
119 | 119 | $type = $param['type']; |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | */ |
252 | 252 | private function applyLike($data, $search_in, $value) |
253 | 253 | { |
254 | - $data->where(function ($w) use ($search_in, $value) { |
|
254 | + $data->where(function($w) use ($search_in, $value) { |
|
255 | 255 | foreach ($search_in as $k => $field) { |
256 | 256 | $method = 'orWhere'; |
257 | 257 | if ($k == 0) { |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | */ |
273 | 273 | private function joinRelatedTables($table, $responsesFields, $name, $data, $nameTmp) |
274 | 274 | { |
275 | - if (! DbInspector::isForeignKey($name)) { |
|
275 | + if (!DbInspector::isForeignKey($name)) { |
|
276 | 276 | return $nameTmp; |
277 | 277 | } |
278 | 278 | $joinTable = DbInspector::getRelatedTableName($name); |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | private function doValidation($inputValidator, $dataValidation, $posts) |
298 | 298 | { |
299 | 299 | $validator = Validator::make($inputValidator, $dataValidation); |
300 | - if (! $validator->fails()) { |
|
300 | + if (!$validator->fails()) { |
|
301 | 301 | return true; |
302 | 302 | } |
303 | 303 | $message = $validator->errors()->all(); |
@@ -313,11 +313,11 @@ discard block |
||
313 | 313 | */ |
314 | 314 | private function filterRedundantResp($responses) |
315 | 315 | { |
316 | - $responses = array_filter($responses, function ($resp) { |
|
317 | - return ! ($resp['name'] == 'ref_id' || $resp['type'] == 'custom'); |
|
316 | + $responses = array_filter($responses, function($resp) { |
|
317 | + return !($resp['name'] == 'ref_id' || $resp['type'] == 'custom'); |
|
318 | 318 | }); |
319 | 319 | |
320 | - $responses = array_filter($responses, function ($resp) { |
|
320 | + $responses = array_filter($responses, function($resp) { |
|
321 | 321 | return (intval($resp['used']) != 0 || DbInspector::isForeignKey($resp['name'])); |
322 | 322 | }); |
323 | 323 | |
@@ -332,15 +332,15 @@ discard block |
||
332 | 332 | private function validateParams($parameters, $table) |
333 | 333 | { |
334 | 334 | $posts = request()->all(); |
335 | - if (! $parameters) { |
|
335 | + if (!$parameters) { |
|
336 | 336 | return ['', '']; |
337 | 337 | } |
338 | 338 | $typeExcept = ['password', 'ref', 'base64_file', 'custom', 'search']; |
339 | 339 | $inputValidator = []; |
340 | 340 | $dataValidation = []; |
341 | 341 | |
342 | - $parameters = array_filter($parameters, function ($param){ |
|
343 | - return !(is_string($param['config'])&& !starts_with($param['config'], '*')); |
|
342 | + $parameters = array_filter($parameters, function($param) { |
|
343 | + return !(is_string($param['config']) && !starts_with($param['config'], '*')); |
|
344 | 344 | }); |
345 | 345 | |
346 | 346 | foreach ($parameters as $param) { |