We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | <!-- elFinder JS (REQUIRED) --> |
18 | 18 | <script src="<?= asset($dir.'/js/elfinder.min.js') ?>"></script> |
19 | 19 | |
20 | - <?php if($locale){ ?> |
|
20 | + <?php if ($locale) { ?> |
|
21 | 21 | <!-- elFinder translation (OPTIONAL) --> |
22 | 22 | <script src="<?= asset($dir."/js/i18n/elfinder.$locale.js") ?>"></script> |
23 | 23 | <?php } ?> |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $().ready(function() { |
41 | 41 | var elf = $('#elfinder').elfinder({ |
42 | 42 | // set your elFinder options here |
43 | - <?php if($locale){ ?> |
|
43 | + <?php if ($locale) { ?> |
|
44 | 44 | lang: '<?= $locale ?>', // locale |
45 | 45 | <?php } ?> |
46 | 46 | customData: { |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | <!-- elFinder JS (REQUIRED) --> |
18 | 18 | <script src="<?= asset($dir.'/js/elfinder.min.js') ?>"></script> |
19 | 19 | |
20 | - <?php if($locale){ ?> |
|
20 | + <?php if ($locale) { ?> |
|
21 | 21 | <!-- elFinder translation (OPTIONAL) --> |
22 | 22 | <script src="<?= asset($dir."/js/i18n/elfinder.$locale.js") ?>"></script> |
23 | 23 | <?php } ?> |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $().ready(function() { |
41 | 41 | var elf = $('#elfinder').elfinder({ |
42 | 42 | // set your elFinder options here |
43 | - <?php if($locale){ ?> |
|
43 | + <?php if ($locale) { ?> |
|
44 | 44 | lang: '<?= $locale ?>', // locale |
45 | 45 | <?php } ?> |
46 | 46 | customData: { |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | <!-- elFinder JS (REQUIRED) --> |
18 | 18 | <script src="<?= asset($dir.'/js/elfinder.min.js') ?>"></script> |
19 | 19 | |
20 | - <?php if($locale){ ?> |
|
20 | + <?php if ($locale) { ?> |
|
21 | 21 | <!-- elFinder translation (OPTIONAL) --> |
22 | 22 | <script src="<?= asset($dir."/js/i18n/elfinder.$locale.js") ?>"></script> |
23 | 23 | <?php } ?> |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $().ready(function() { |
41 | 41 | var elf = $('#elfinder').elfinder({ |
42 | 42 | // set your elFinder options here |
43 | - <?php if($locale){ ?> |
|
43 | + <?php if ($locale) { ?> |
|
44 | 44 | lang: '<?= $locale ?>', // locale |
45 | 45 | <?php } ?> |
46 | 46 | customData: { |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | <!-- elFinder JS (REQUIRED) --> |
18 | 18 | <script src="<?= asset($dir.'/js/elfinder.min.js') ?>"></script> |
19 | 19 | |
20 | - <?php if($locale){ ?> |
|
20 | + <?php if ($locale) { ?> |
|
21 | 21 | <!-- elFinder translation (OPTIONAL) --> |
22 | 22 | <script src="<?= asset($dir."/js/i18n/elfinder.$locale.js") ?>"></script> |
23 | 23 | <?php } ?> |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $().ready(function() { |
41 | 41 | var elf = $('#elfinder').elfinder({ |
42 | 42 | // set your elFinder options here |
43 | - <?php if($locale){ ?> |
|
43 | + <?php if ($locale) { ?> |
|
44 | 44 | lang: '<?= $locale ?>', // locale |
45 | 45 | <?php } ?> |
46 | 46 | customData: { |
@@ -12,14 +12,14 @@ |
||
12 | 12 | |-------------------------------------------------------------------------- |
13 | 13 | */ |
14 | 14 | |
15 | - public static function getPossibleEnumValues($field_name){ |
|
15 | + public static function getPossibleEnumValues($field_name) { |
|
16 | 16 | $instance = new static; // create an instance of the model to be able to get the table name |
17 | - $type = DB::select( DB::raw('SHOW COLUMNS FROM '.$instance->getTable().' WHERE Field = "'.$field_name.'"') )[0]->Type; |
|
17 | + $type = DB::select(DB::raw('SHOW COLUMNS FROM '.$instance->getTable().' WHERE Field = "'.$field_name.'"'))[0]->Type; |
|
18 | 18 | preg_match('/^enum\((.*)\)$/', $type, $matches); |
19 | 19 | $enum = array(); |
20 | 20 | $exploded = explode(',', $matches[1]); |
21 | - foreach($exploded as $value){ |
|
22 | - $v = trim( $value, "'" ); |
|
21 | + foreach ($exploded as $value) { |
|
22 | + $v = trim($value, "'"); |
|
23 | 23 | $enum[] = $v; |
24 | 24 | } |
25 | 25 | return $enum; |
@@ -161,7 +161,7 @@ |
||
161 | 161 | * Remove the specified resource from storage. |
162 | 162 | * |
163 | 163 | * @param int $id |
164 | - * @return string |
|
164 | + * @return \Illuminate\Http\Response |
|
165 | 165 | */ |
166 | 166 | public function destroy($id) |
167 | 167 | { |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * Store a newly created resource in storage. |
55 | 55 | * |
56 | 56 | * @param \Illuminate\Http\Request $request |
57 | - * @return \Illuminate\Http\Response |
|
57 | + * @return \Illuminate\Http\RedirectResponse |
|
58 | 58 | */ |
59 | 59 | public function crudStore(Request $request = null) |
60 | 60 | { |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * |
102 | 102 | * @param \Illuminate\Http\Request $request |
103 | 103 | * @param int $id |
104 | - * @return \Illuminate\Http\Response |
|
104 | + * @return \Illuminate\Http\RedirectResponse |
|
105 | 105 | */ |
106 | 106 | public function crudUpdate($parentId, $id, Request $request = null) |
107 | 107 | { |
@@ -286,6 +286,7 @@ discard block |
||
286 | 286 | * Delete a row from the database. |
287 | 287 | * |
288 | 288 | * @param [int] The id of the item to be deleted. |
289 | + * @param integer $id |
|
289 | 290 | * @return [bool] Deletion confirmation. |
290 | 291 | * |
291 | 292 | * TODO: should this delete items with relations to it too? |
@@ -404,7 +405,8 @@ discard block |
||
404 | 405 | * Check if a permission is enabled for a Crud Panel. Fail if not. |
405 | 406 | * |
406 | 407 | * @param [string] Permission. |
407 | - * @return boolean |
|
408 | + * @param string $permission |
|
409 | + * @return boolean|null |
|
408 | 410 | */ |
409 | 411 | public function hasAccessOrFail($permission) |
410 | 412 | { |
@@ -433,6 +435,7 @@ discard block |
||
433 | 435 | * All Create-Read-Update-Delete operations are done using that Eloquent Collection. |
434 | 436 | * |
435 | 437 | * @param [string] Full model namespace. Ex: App\Models\Article |
438 | + * @param string $model_namespace |
|
436 | 439 | */ |
437 | 440 | public function setModel($model_namespace) |
438 | 441 | { |
@@ -460,6 +463,7 @@ discard block |
||
460 | 463 | * |
461 | 464 | * @param [string] Route name. |
462 | 465 | * @param [array] Parameters. |
466 | + * @param string $route |
|
463 | 467 | */ |
464 | 468 | public function setRoute($route) |
465 | 469 | { |
@@ -492,7 +496,7 @@ discard block |
||
492 | 496 | * - $this->crud->setRouteName('admin.article') |
493 | 497 | * - $this->crud->route = "admin/article" |
494 | 498 | * |
495 | - * @return [string] |
|
499 | + * @return string |
|
496 | 500 | */ |
497 | 501 | public function getRoute() |
498 | 502 | { |
@@ -505,6 +509,8 @@ discard block |
||
505 | 509 | * |
506 | 510 | * @param [string] Entity name, in singular. Ex: article |
507 | 511 | * @param [string] Entity name, in plural. Ex: articles |
512 | + * @param string $singular |
|
513 | + * @param string $plural |
|
508 | 514 | */ |
509 | 515 | public function setEntityNameStrings($singular, $plural) { |
510 | 516 | $this->entity_name = $singular; |
@@ -1237,6 +1243,9 @@ discard block |
||
1237 | 1243 | return array_filter($this->{$entity}[] = $this->syncField($field)); |
1238 | 1244 | } |
1239 | 1245 | |
1246 | + /** |
|
1247 | + * @param string $entity |
|
1248 | + */ |
|
1240 | 1249 | public function addMultiple($entity, $field) |
1241 | 1250 | { |
1242 | 1251 | $this->{$entity} = array_filter(array_map([$this, 'syncField'], $fields)); |
@@ -1256,16 +1265,25 @@ discard block |
||
1256 | 1265 | |
1257 | 1266 | |
1258 | 1267 | |
1268 | + /** |
|
1269 | + * @param string $entity |
|
1270 | + */ |
|
1259 | 1271 | public function remove($entity, $fields) |
1260 | 1272 | { |
1261 | 1273 | return array_values(array_filter($this->{$entity}, function($field) use ($fields) { return !in_array($field['name'], (array)$fields);})); |
1262 | 1274 | } |
1263 | 1275 | |
1276 | + /** |
|
1277 | + * @param string $items |
|
1278 | + */ |
|
1264 | 1279 | public function setSort($items, $order) |
1265 | 1280 | { |
1266 | 1281 | $this->sort[$items] = $order; |
1267 | 1282 | } |
1268 | 1283 | |
1284 | + /** |
|
1285 | + * @param string $items |
|
1286 | + */ |
|
1269 | 1287 | public function sort($items) |
1270 | 1288 | { |
1271 | 1289 | if (array_key_exists($items, $this->sort)) |
@@ -1301,6 +1319,10 @@ discard block |
||
1301 | 1319 | } |
1302 | 1320 | |
1303 | 1321 | // face un fel de merge intre ce ii dai si ce e in CRUD |
1322 | + |
|
1323 | + /** |
|
1324 | + * @param string $entity |
|
1325 | + */ |
|
1304 | 1326 | public function syncRelations($entity) |
1305 | 1327 | { |
1306 | 1328 | foreach ($this->relations as $field => $relation) { |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public function getCreateFields() |
82 | 82 | { |
83 | - return $this->prepareFields(empty($this->create_fields)?$this->fields:$this->create_fields); |
|
83 | + return $this->prepareFields(empty($this->create_fields) ? $this->fields : $this->create_fields); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
@@ -91,16 +91,16 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function getRelationFields($form = 'create') |
93 | 93 | { |
94 | - if( $form == 'create' ){ |
|
95 | - $fields = empty($this->create_fields)?$this->fields:$this->create_fields; |
|
96 | - }else{ |
|
97 | - $fields = empty($this->update_fields)?$this->fields:$this->update_fields; |
|
94 | + if ($form == 'create') { |
|
95 | + $fields = empty($this->create_fields) ? $this->fields : $this->create_fields; |
|
96 | + } else { |
|
97 | + $fields = empty($this->update_fields) ? $this->fields : $this->update_fields; |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | $relationFields = []; |
101 | 101 | |
102 | - foreach($fields as $field){ |
|
103 | - if(isset($field['model']) || isset($field['dependencies'])){ |
|
102 | + foreach ($fields as $field) { |
|
103 | + if (isset($field['model']) || isset($field['dependencies'])) { |
|
104 | 104 | array_push($relationFields, $field); |
105 | 105 | } |
106 | 106 | } |
@@ -116,22 +116,22 @@ discard block |
||
116 | 116 | |
117 | 117 | foreach ($relations as $key => $relation) |
118 | 118 | { |
119 | - if ( (isset($relation['pivot']) && $relation['pivot'] ) || isset($relation['dependencies']) ){ |
|
120 | - if(is_array($relation['name'])){ |
|
121 | - foreach($relation['name'] as $relation){ |
|
122 | - if(isset($data[$relation])){ |
|
119 | + if ((isset($relation['pivot']) && $relation['pivot']) || isset($relation['dependencies'])) { |
|
120 | + if (is_array($relation['name'])) { |
|
121 | + foreach ($relation['name'] as $relation) { |
|
122 | + if (isset($data[$relation])) { |
|
123 | 123 | $model->{$relation}()->sync($data[$relation]); |
124 | - }else{ |
|
124 | + } else { |
|
125 | 125 | $model->{$relation}()->sync([]); |
126 | 126 | } |
127 | 127 | } |
128 | - }else{ |
|
128 | + } else { |
|
129 | 129 | $model->{$relation['name']}()->sync($data[$relation['name']]); |
130 | 130 | } |
131 | 131 | |
132 | - if( isset($relation['pivotFields']) ){ |
|
133 | - foreach($relation['pivotFields'] as $pivotField){ |
|
134 | - foreach($data[$pivotField] as $pivot_id => $field){ |
|
132 | + if (isset($relation['pivotFields'])) { |
|
133 | + foreach ($relation['pivotFields'] as $pivotField) { |
|
134 | + foreach ($data[$pivotField] as $pivot_id => $field) { |
|
135 | 135 | $model->{$relation['name']}()->updateExistingPivot($pivot_id, [$pivotField => $field]); |
136 | 136 | } |
137 | 137 | } |
@@ -289,21 +289,21 @@ discard block |
||
289 | 289 | */ |
290 | 290 | public function getUpdateFields($id) |
291 | 291 | { |
292 | - $fields = $this->prepareFields(empty($this->update_fields)?$this->fields:$this->update_fields); |
|
292 | + $fields = $this->prepareFields(empty($this->update_fields) ? $this->fields : $this->update_fields); |
|
293 | 293 | $entry = $this->getEntry($id); |
294 | 294 | |
295 | 295 | foreach ($fields as $k => $field) { |
296 | 296 | // set the value |
297 | 297 | if (!isset($fields[$k]['value'])) |
298 | 298 | { |
299 | - if(is_array($field['name'])){ |
|
299 | + if (is_array($field['name'])) { |
|
300 | 300 | |
301 | 301 | $fields[$k]['value'] = []; |
302 | - foreach($field['name'] as $key => $relation){ |
|
302 | + foreach ($field['name'] as $key => $relation) { |
|
303 | 303 | $fields[$k]['value'][] = $entry->{$relation}; |
304 | 304 | } |
305 | 305 | |
306 | - }else{ |
|
306 | + } else { |
|
307 | 307 | $fields[$k]['value'] = $entry->{$field['name']}; |
308 | 308 | } |
309 | 309 | } |
@@ -422,13 +422,13 @@ discard block |
||
422 | 422 | public function allowAccess($access) |
423 | 423 | { |
424 | 424 | // $this->addButtons((array)$access); |
425 | - return $this->access = array_merge(array_diff((array)$access, $this->access), $this->access); |
|
425 | + return $this->access = array_merge(array_diff((array) $access, $this->access), $this->access); |
|
426 | 426 | } |
427 | 427 | |
428 | 428 | public function denyAccess($access) |
429 | 429 | { |
430 | 430 | // $this->removeButtons((array)$access); |
431 | - return $this->access = array_diff($this->access, (array)$access); |
|
431 | + return $this->access = array_diff($this->access, (array) $access); |
|
432 | 432 | } |
433 | 433 | |
434 | 434 | /** |
@@ -641,7 +641,7 @@ discard block |
||
641 | 641 | */ |
642 | 642 | public function addDefaultTypeToColumn($column) |
643 | 643 | { |
644 | - if (array_key_exists('name', (array)$column)) |
|
644 | + if (array_key_exists('name', (array) $column)) |
|
645 | 645 | { |
646 | 646 | $default_type = $this->getFieldTypeFromDbColumnType($column['name']); |
647 | 647 | return array_merge(['type' => $default_type], $column); |
@@ -657,7 +657,7 @@ discard block |
||
657 | 657 | * @param [field or column] |
658 | 658 | */ |
659 | 659 | public function addDefaultLabel($array) { |
660 | - if (!array_key_exists('label', (array)$array) && array_key_exists('name', (array)$array)) { |
|
660 | + if (!array_key_exists('label', (array) $array) && array_key_exists('name', (array) $array)) { |
|
661 | 661 | $array = array_merge(['label' => ucfirst($this->makeLabel($array['name']))], $array); |
662 | 662 | return $array; |
663 | 663 | } |
@@ -831,7 +831,7 @@ discard block |
||
831 | 831 | array_map(function($field) { |
832 | 832 | // $this->labels[$field] = $this->makeLabel($field); |
833 | 833 | |
834 | - $this->fields[] = [ |
|
834 | + $this->fields[] = [ |
|
835 | 835 | 'name' => $field, |
836 | 836 | 'label' => ucfirst($field), |
837 | 837 | 'value' => '', 'default' => $this->field_types[$field]['default'], |
@@ -1173,7 +1173,7 @@ discard block |
||
1173 | 1173 | |
1174 | 1174 | public function orderColumns($order) |
1175 | 1175 | { |
1176 | - $this->setSort('columns', (array)$order); |
|
1176 | + $this->setSort('columns', (array) $order); |
|
1177 | 1177 | } |
1178 | 1178 | |
1179 | 1179 | |
@@ -1248,13 +1248,13 @@ discard block |
||
1248 | 1248 | |
1249 | 1249 | public function orderFields($order) |
1250 | 1250 | { |
1251 | - $this->setSort('fields', (array)$order); |
|
1251 | + $this->setSort('fields', (array) $order); |
|
1252 | 1252 | } |
1253 | 1253 | |
1254 | 1254 | |
1255 | 1255 | public function syncField($field) |
1256 | 1256 | { |
1257 | - if (array_key_exists('name', (array)$field)) return array_merge(['type' => $this->getFieldTypeFromDbColumnType($field['name']), 'value' => '', 'default' => null, 'values' => [], 'attributes' => []], $field); |
|
1257 | + if (array_key_exists('name', (array) $field)) return array_merge(['type' => $this->getFieldTypeFromDbColumnType($field['name']), 'value' => '', 'default' => null, 'values' => [], 'attributes' => []], $field); |
|
1258 | 1258 | |
1259 | 1259 | return false; |
1260 | 1260 | } |
@@ -1293,7 +1293,7 @@ discard block |
||
1293 | 1293 | if (!empty($this->{$type})) |
1294 | 1294 | { |
1295 | 1295 | $this->{$type} = array_map(function($field) use ($fields, $attributes) { |
1296 | - if (in_array($field['name'], (array)$fields)) $field = array_merge($field, $attributes); |
|
1296 | + if (in_array($field['name'], (array) $fields)) $field = array_merge($field, $attributes); |
|
1297 | 1297 | |
1298 | 1298 | return $field; |
1299 | 1299 | }, $this->{$type}); |
@@ -1304,7 +1304,7 @@ discard block |
||
1304 | 1304 | |
1305 | 1305 | public function remove($entity, $fields) |
1306 | 1306 | { |
1307 | - return array_values(array_filter($this->{$entity}, function($field) use ($fields) { return !in_array($field['name'], (array)$fields);})); |
|
1307 | + return array_values(array_filter($this->{$entity}, function($field) use ($fields) { return !in_array($field['name'], (array) $fields); })); |
|
1308 | 1308 | } |
1309 | 1309 | |
1310 | 1310 | public function setSort($items, $order) |
@@ -1323,7 +1323,7 @@ discard block |
||
1323 | 1323 | if (is_numeric($key = array_search($item, array_column($this->{$items}, 'name')))) $elements[] = $this->{$items}[$key]; |
1324 | 1324 | } |
1325 | 1325 | |
1326 | - return $this->{$items} = array_merge($elements, array_filter($this->{$items}, function($item) use($items) {return !in_array($item['name'], $this->sort[$items]);})); |
|
1326 | + return $this->{$items} = array_merge($elements, array_filter($this->{$items}, function($item) use($items) {return !in_array($item['name'], $this->sort[$items]); })); |
|
1327 | 1327 | } |
1328 | 1328 | |
1329 | 1329 | return $this->{$items}; |
@@ -1336,7 +1336,7 @@ discard block |
||
1336 | 1336 | // cred ca ia valorile din tabela de legatura ca sa ti le afiseze in select |
1337 | 1337 | public function getRelationValues($model, $field, $where = [], $order = []) |
1338 | 1338 | { |
1339 | - $order = (array)$order; |
|
1339 | + $order = (array) $order; |
|
1340 | 1340 | $values = $model->select('*'); |
1341 | 1341 | |
1342 | 1342 | if (!empty($where)) call_user_func_array([$values, $where[0]], array_slice($where, 1)); |
@@ -38,6 +38,9 @@ discard block |
||
38 | 38 | $this->initState(); |
39 | 39 | } |
40 | 40 | |
41 | + /** |
|
42 | + * @param string $model |
|
43 | + */ |
|
41 | 44 | public function setModel($model) |
42 | 45 | { |
43 | 46 | if (!class_exists($model)) throw new \Exception('This model does not exist.', 404); |
@@ -54,6 +57,10 @@ discard block |
||
54 | 57 | } |
55 | 58 | |
56 | 59 | // TODO: make this work without having to specify "index" |
60 | + |
|
61 | + /** |
|
62 | + * @param string $route |
|
63 | + */ |
|
57 | 64 | public function setRoute($route, $parameters = []) |
58 | 65 | { |
59 | 66 | if (!\Route::has($route)) throw new \Exception('This route does not exist.', 404); |
@@ -259,6 +266,9 @@ discard block |
||
259 | 266 | return $model; |
260 | 267 | } |
261 | 268 | |
269 | + /** |
|
270 | + * @param integer $id |
|
271 | + */ |
|
262 | 272 | public function delete($id) // DONE |
263 | 273 | { |
264 | 274 | return $this->model->destroy($id); |
@@ -489,6 +499,9 @@ discard block |
||
489 | 499 | return array_filter($this->{$entity}[] = $this->syncField($field)); |
490 | 500 | } |
491 | 501 | |
502 | + /** |
|
503 | + * @param string $entity |
|
504 | + */ |
|
492 | 505 | private function addMultiple($entity, $field) |
493 | 506 | { |
494 | 507 | $this->{$entity} = array_filter(array_map([$this, 'syncField'], $fields)); |
@@ -506,16 +519,25 @@ discard block |
||
506 | 519 | } |
507 | 520 | } |
508 | 521 | |
522 | + /** |
|
523 | + * @param string $entity |
|
524 | + */ |
|
509 | 525 | private function remove($entity, $fields) |
510 | 526 | { |
511 | 527 | return array_values(array_filter($this->{$entity}, function($field) use ($fields) { return !in_array($field['name'], (array)$fields);})); |
512 | 528 | } |
513 | 529 | |
530 | + /** |
|
531 | + * @param string $items |
|
532 | + */ |
|
514 | 533 | private function setSort($items, $order) |
515 | 534 | { |
516 | 535 | $this->sort[$items] = $order; |
517 | 536 | } |
518 | 537 | |
538 | + /** |
|
539 | + * @param string $items |
|
540 | + */ |
|
519 | 541 | private function sort($items) |
520 | 542 | { |
521 | 543 | if (array_key_exists($items, $this->sort)) |
@@ -561,6 +583,9 @@ discard block |
||
561 | 583 | return $values->get()->lists($field, $model->getKeyName())->toArray(); |
562 | 584 | } |
563 | 585 | |
586 | + /** |
|
587 | + * @param string $entity |
|
588 | + */ |
|
564 | 589 | private function syncRelations($entity) |
565 | 590 | { |
566 | 591 | foreach ($this->relations as $field => $relation) { |
@@ -125,9 +125,9 @@ discard block |
||
125 | 125 | |
126 | 126 | public function removePermissions($permissions) // DONE |
127 | 127 | { |
128 | - $this->removeButtons((array)$permissions); |
|
128 | + $this->removeButtons((array) $permissions); |
|
129 | 129 | |
130 | - return $this->permissions = array_diff($this->permissions, (array)$permissions); |
|
130 | + return $this->permissions = array_diff($this->permissions, (array) $permissions); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | public function setColumns($columns) |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | |
159 | 159 | public function orderColumns($order) |
160 | 160 | { |
161 | - $this->setSort('columns', (array)$order); |
|
161 | + $this->setSort('columns', (array) $order); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | public function setFields($fields) |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | |
229 | 229 | public function orderFields($order) |
230 | 230 | { |
231 | - $this->setSort('fields', (array)$order); |
|
231 | + $this->setSort('fields', (array) $order); |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | public function items() |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | |
288 | 288 | public function unsetListActions($actions) |
289 | 289 | { |
290 | - return $this->listActions = array_diff($this->listActions, (array)$actions); |
|
290 | + return $this->listActions = array_diff($this->listActions, (array) $actions); |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | public function checkListAction($action) |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | |
313 | 313 | public function setRequired($fields) |
314 | 314 | { |
315 | - $this->required = array_merge($this->required, (array)$fields); |
|
315 | + $this->required = array_merge($this->required, (array) $fields); |
|
316 | 316 | } |
317 | 317 | |
318 | 318 | public function required() |
@@ -380,14 +380,14 @@ discard block |
||
380 | 380 | |
381 | 381 | private function syncColumn($column) |
382 | 382 | { |
383 | - if (array_key_exists('name', (array)$column)) return array_merge(['type' => $this->getType($column['name'])], $column); |
|
383 | + if (array_key_exists('name', (array) $column)) return array_merge(['type' => $this->getType($column['name'])], $column); |
|
384 | 384 | |
385 | 385 | return false; |
386 | 386 | } |
387 | 387 | |
388 | 388 | private function syncField($field) |
389 | 389 | { |
390 | - if (array_key_exists('name', (array)$field)) return array_merge(['type' => $this->getType($field['name']), 'value' => '', 'default' => null, 'values' => [], 'attributes' => []], $field); |
|
390 | + if (array_key_exists('name', (array) $field)) return array_merge(['type' => $this->getType($field['name']), 'value' => '', 'default' => null, 'values' => [], 'attributes' => []], $field); |
|
391 | 391 | |
392 | 392 | return false; |
393 | 393 | } |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | if (!empty($this->{$type})) |
500 | 500 | { |
501 | 501 | $this->{$type} = array_map(function($field) use ($fields, $attributes) { |
502 | - if (in_array($field['name'], (array)$fields)) $field = array_merge($field, $attributes); |
|
502 | + if (in_array($field['name'], (array) $fields)) $field = array_merge($field, $attributes); |
|
503 | 503 | |
504 | 504 | return $field; |
505 | 505 | }, $this->{$type}); |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | |
509 | 509 | private function remove($entity, $fields) |
510 | 510 | { |
511 | - return array_values(array_filter($this->{$entity}, function($field) use ($fields) { return !in_array($field['name'], (array)$fields);})); |
|
511 | + return array_values(array_filter($this->{$entity}, function($field) use ($fields) { return !in_array($field['name'], (array) $fields); })); |
|
512 | 512 | } |
513 | 513 | |
514 | 514 | private function setSort($items, $order) |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | if (is_numeric($key = array_search($item, array_column($this->{$items}, 'name')))) $elements[] = $this->{$items}[$key]; |
528 | 528 | } |
529 | 529 | |
530 | - return $this->{$items} = array_merge($elements, array_filter($this->{$items}, function($item) use($items) {return !in_array($item['name'], $this->sort[$items]);})); |
|
530 | + return $this->{$items} = array_merge($elements, array_filter($this->{$items}, function($item) use($items) {return !in_array($item['name'], $this->sort[$items]); })); |
|
531 | 531 | } |
532 | 532 | |
533 | 533 | return $this->{$items}; |
@@ -537,11 +537,11 @@ discard block |
||
537 | 537 | { |
538 | 538 | foreach ($this->relations as $key => $relation) |
539 | 539 | { |
540 | - if ($relation['pivot']){ |
|
540 | + if ($relation['pivot']) { |
|
541 | 541 | $model->{$relation['name']}()->sync($data[$key]); |
542 | 542 | |
543 | - foreach($relation['pivotFields'] as $pivotField){ |
|
544 | - foreach($data[$pivotField] as $pivot_id => $field){ |
|
543 | + foreach ($relation['pivotFields'] as $pivotField) { |
|
544 | + foreach ($data[$pivotField] as $pivot_id => $field) { |
|
545 | 545 | $model->{$relation['name']}()->updateExistingPivot($pivot_id, [$pivotField => $field]); |
546 | 546 | } |
547 | 547 | } |
@@ -551,7 +551,7 @@ discard block |
||
551 | 551 | |
552 | 552 | private function getRelationValues($model, $field, $where = [], $order = []) |
553 | 553 | { |
554 | - $order = (array)$order; |
|
554 | + $order = (array) $order; |
|
555 | 555 | $values = $model->select('*'); |
556 | 556 | |
557 | 557 | if (!empty($where)) call_user_func_array([$values, $where[0]], array_slice($where, 1)); |