@@ -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 |
@@ -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) { |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | if ($filter_is_orderby === true) { |
68 | 68 | (new Order($this->cb))->handle($query, $table); |
69 | 69 | } |
70 | - $limit = is_string($limit) ? (int)$limit : 15; |
|
70 | + $limit = is_string($limit) ? (int) $limit : 15; |
|
71 | 71 | $data['result'] = $query->paginate($limit); |
72 | 72 | |
73 | 73 | $data['columns'] = $columns_table; |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | //LISTING INDEX HTML |
80 | 80 | $addAction = $CbCtrl->data['addAction']; |
81 | 81 | |
82 | - if (! empty($CbCtrl->sub_module)) { |
|
82 | + if (!empty($CbCtrl->sub_module)) { |
|
83 | 83 | $addAction = $this->_handleSubModules($addAction); |
84 | 84 | } |
85 | 85 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | //$orig_mainpath = $CbCtrl->data['mainpath']; |
88 | 88 | //$titleField = $CbCtrl->titleField; |
89 | 89 | $number = (request('page', 1) - 1) * $limit + 1; |
90 | - $columnsTable = array_filter($columns_table, function ($col) { |
|
90 | + $columnsTable = array_filter($columns_table, function($col) { |
|
91 | 91 | return $col['visible'] !== false; |
92 | 92 | }); |
93 | 93 | $htmlContents = (new RowContent($CbCtrl))->calculate($data, $number, $columnsTable, $addAction); //end foreach data[result] |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | private function _handleParentTable() |
104 | 104 | { |
105 | 105 | $data = []; |
106 | - $parent = (string)request('parent_table'); |
|
106 | + $parent = (string) request('parent_table'); |
|
107 | 107 | $data['parent_table'] = CRUDBooster::first(request('parent_table'), request('parent_id')); |
108 | 108 | if (request('foreign_key')) { |
109 | 109 | $data['parent_field'] = request('foreign_key'); |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | $data['parent_field'] = DbInspector::getRelatedTableName($parent); |
112 | 112 | } |
113 | 113 | |
114 | - if (! $data['parent_field']) { |
|
114 | + if (!$data['parent_field']) { |
|
115 | 115 | return $data; |
116 | 116 | } |
117 | 117 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | */ |
130 | 130 | private function _filterForParent($result) |
131 | 131 | { |
132 | - if (! request('parent_id')) { |
|
132 | + if (!request('parent_id')) { |
|
133 | 133 | return null; |
134 | 134 | } |
135 | 135 | |
@@ -198,9 +198,9 @@ discard block |
||
198 | 198 | private function _applyWhereAndQfilters($result, $columnsTable, $table) |
199 | 199 | { |
200 | 200 | if (request('q')) { |
201 | - $result->where(function ($query) use ($columnsTable) { |
|
201 | + $result->where(function($query) use ($columnsTable) { |
|
202 | 202 | foreach ($columnsTable as $col) { |
203 | - if (! $col['field_with']) { |
|
203 | + if (!$col['field_with']) { |
|
204 | 204 | continue; |
205 | 205 | } |
206 | 206 | $query->orwhere($col['field_with'], "like", "%".request("q")."%"); |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | return CRUDBooster::adminPath($module['path']).'?parent_table='.$table_parent.'&parent_columns=' |
245 | 245 | .$module['parent_columns'].'&parent_columns_alias=' |
246 | 246 | .$module['parent_columns_alias'].'&parent_id=[' |
247 | - .(! isset($module['custom_parent_id']) ? "id" : $module['custom_parent_id']) |
|
247 | + .(!isset($module['custom_parent_id']) ? "id" : $module['custom_parent_id']) |
|
248 | 248 | .']&return_url='.urlencode(Request::fullUrl()).'&foreign_key=' |
249 | 249 | .$module['foreign_key'].'&label='.urlencode($module['label']); |
250 | 250 | } |