We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -3,7 +3,7 @@ |
||
3 | 3 | <?php |
4 | 4 | // if the column has been cast to Carbon or Date (using attribute casting) |
5 | 5 | // get the value as a date string |
6 | -if (isset($field['value']) && ( $field['value'] instanceof \Carbon\CarbonInterface )) { |
|
6 | +if (isset($field['value']) && ($field['value'] instanceof \Carbon\CarbonInterface)) { |
|
7 | 7 | $field['value'] = $field['value']->toDateString(); |
8 | 8 | } |
9 | 9 | ?> |
@@ -3,11 +3,11 @@ |
||
3 | 3 | <?php |
4 | 4 | // if the column has been cast to Carbon or Date (using attribute casting) |
5 | 5 | // get the value as a date string |
6 | -if (isset($field['value']) && ( $field['value'] instanceof \Carbon\CarbonInterface )) { |
|
6 | +if (isset($field['value']) && ($field['value'] instanceof \Carbon\CarbonInterface)) { |
|
7 | 7 | $field['value'] = $field['value']->format('Y-m-d H:i:s'); |
8 | 8 | } |
9 | 9 | |
10 | - $field_language = isset($field['datetime_picker_options']['language'])?$field['datetime_picker_options']['language']:\App::getLocale(); |
|
10 | + $field_language = isset($field['datetime_picker_options']['language']) ? $field['datetime_picker_options']['language'] : \App::getLocale(); |
|
11 | 11 | ?> |
12 | 12 | |
13 | 13 | <div @include('crud::inc.field_wrapper_attributes') > |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $conn->getDoctrineSchemaManager()->getDatabasePlatform()->registerDoctrineTypeMapping('json', 'json_array'); |
70 | 70 | $conn->getDoctrineSchemaManager()->getDatabasePlatform()->registerDoctrineTypeMapping('jsonb', 'json_array'); |
71 | 71 | |
72 | - return ! $conn->getDoctrineColumn($table, $column_name)->getNotnull(); |
|
72 | + return !$conn->getDoctrineColumn($table, $column_name)->getNotnull(); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | /* |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | public function addFakes($columns = ['extras']) |
87 | 87 | { |
88 | 88 | foreach ($columns as $key => $column) { |
89 | - if (! isset($this->attributes[$column])) { |
|
89 | + if (!isset($this->attributes[$column])) { |
|
90 | 90 | continue; |
91 | 91 | } |
92 | 92 | |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | */ |
135 | 135 | public function shouldDecodeFake($column) |
136 | 136 | { |
137 | - return ! in_array($column, array_keys($this->casts)); |
|
137 | + return !in_array($column, array_keys($this->casts)); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | */ |
146 | 146 | public function shouldEncodeFake($column) |
147 | 147 | { |
148 | - return ! in_array($column, array_keys($this->casts)); |
|
148 | + return !in_array($column, array_keys($this->casts)); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | /* |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | public function uploadMultipleFilesToDisk($value, $attribute_name, $disk, $destination_path) |
220 | 220 | { |
221 | 221 | $request = \Request::instance(); |
222 | - if (! is_array($this->{$attribute_name})) { |
|
222 | + if (!is_array($this->{$attribute_name})) { |
|
223 | 223 | $attribute_value = json_decode($this->{$attribute_name}, true) ?? []; |
224 | 224 | } else { |
225 | 225 | $attribute_value = $this->{$attribute_name}; |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | if ($files_to_clear) { |
232 | 232 | foreach ($files_to_clear as $key => $filename) { |
233 | 233 | \Storage::disk($disk)->delete($filename); |
234 | - $attribute_value = array_where($attribute_value, function ($value, $key) use ($filename) { |
|
234 | + $attribute_value = array_where($attribute_value, function($value, $key) use ($filename) { |
|
235 | 235 | return $value != $filename; |
236 | 236 | }); |
237 | 237 | } |
@@ -21,13 +21,13 @@ |
||
21 | 21 | |
22 | 22 | public function __construct() |
23 | 23 | { |
24 | - if (! $this->crud) { |
|
24 | + if (!$this->crud) { |
|
25 | 25 | // make a new CrudPanel object, from the one stored in Laravel's service container |
26 | 26 | $this->crud = app()->make('crud'); |
27 | 27 | |
28 | 28 | // call the setup function inside this closure to also have the request there |
29 | 29 | // this way, developers can use things stored in session (auth variables, etc) |
30 | - $this->middleware(function ($request, $next) { |
|
30 | + $this->middleware(function($request, $next) { |
|
31 | 31 | $this->request = $request; |
32 | 32 | $this->crud->request = $request; |
33 | 33 | $this->setup(); |
@@ -86,13 +86,13 @@ discard block |
||
86 | 86 | public function register() |
87 | 87 | { |
88 | 88 | // Bind the CrudPanel object to Laravel's service container |
89 | - $this->app->singleton('crud', function ($app) { |
|
89 | + $this->app->singleton('crud', function($app) { |
|
90 | 90 | return new CrudPanel($app); |
91 | 91 | }); |
92 | 92 | |
93 | 93 | // load a macro for Route, |
94 | 94 | // for developers to be able to load all routes for a CRUD resource in one line |
95 | - if (! Route::hasMacro('crud')) { |
|
95 | + if (!Route::hasMacro('crud')) { |
|
96 | 96 | $this->addRouteMacro(); |
97 | 97 | } |
98 | 98 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | $this->commands($this->commands); |
104 | 104 | |
105 | 105 | // map the elfinder prefix |
106 | - if (! \Config::get('elfinder.route.prefix')) { |
|
106 | + if (!\Config::get('elfinder.route.prefix')) { |
|
107 | 107 | \Config::set('elfinder.route.prefix', \Config::get('backpack.base.route_prefix').'/elfinder'); |
108 | 108 | } |
109 | 109 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | */ |
117 | 117 | private function addRouteMacro() |
118 | 118 | { |
119 | - Route::macro('crud', function ($name, $controller) { |
|
119 | + Route::macro('crud', function($name, $controller) { |
|
120 | 120 | // put together the route name prefix, |
121 | 121 | // as passed to the Route::group() statements |
122 | 122 | $routeName = ''; |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | { |
163 | 163 | $crudPubPath = public_path('vendor/backpack/crud'); |
164 | 164 | |
165 | - if (! is_dir($crudPubPath)) { |
|
165 | + if (!is_dir($crudPubPath)) { |
|
166 | 166 | return true; |
167 | 167 | } |
168 | 168 |
@@ -24,11 +24,11 @@ discard block |
||
24 | 24 | |
25 | 25 | $saveOptions = collect($permissions) |
26 | 26 | // Restrict list to allowed actions. |
27 | - ->filter(function ($action, $permission) { |
|
27 | + ->filter(function($action, $permission) { |
|
28 | 28 | return $this->hasAccess($permission); |
29 | 29 | }) |
30 | 30 | // Generate list of possible actions. |
31 | - ->mapWithKeys(function ($action, $permission) { |
|
31 | + ->mapWithKeys(function($action, $permission) { |
|
32 | 32 | return [$action => $this->getSaveActionButtonName($action)]; |
33 | 33 | }) |
34 | 34 | ->all(); |
@@ -63,8 +63,7 @@ discard block |
||
63 | 63 | */ |
64 | 64 | public function setSaveAction($forceSaveAction = null) |
65 | 65 | { |
66 | - $saveAction = $forceSaveAction ?: |
|
67 | - \Request::input('save_action', config('backpack.crud.default_save_action', 'save_and_back')); |
|
66 | + $saveAction = $forceSaveAction ?: \Request::input('save_action', config('backpack.crud.default_save_action', 'save_and_back')); |
|
68 | 67 | |
69 | 68 | if (config('backpack.crud.show_save_action_change', true) && |
70 | 69 | session('save_action', 'save_and_back') !== $saveAction) { |
@@ -76,11 +76,11 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function setModel($model_namespace) |
78 | 78 | { |
79 | - if (! class_exists($model_namespace)) { |
|
79 | + if (!class_exists($model_namespace)) { |
|
80 | 80 | throw new \Exception('The model does not exist.', 500); |
81 | 81 | } |
82 | 82 | |
83 | - if (! method_exists($model_namespace, 'hasCrudTrait')) { |
|
83 | + if (!method_exists($model_namespace, 'hasCrudTrait')) { |
|
84 | 84 | throw new \Exception('Please use CrudTrait on the model.', 500); |
85 | 85 | } |
86 | 86 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | { |
144 | 144 | $complete_route = $route.'.index'; |
145 | 145 | |
146 | - if (! \Route::has($complete_route)) { |
|
146 | + if (!\Route::has($complete_route)) { |
|
147 | 147 | throw new \Exception('There are no routes for this route name.', 404); |
148 | 148 | } |
149 | 149 | |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | */ |
245 | 245 | public function getFirstOfItsTypeInArray($type, $array) |
246 | 246 | { |
247 | - return array_first($array, function ($item) use ($type) { |
|
247 | + return array_first($array, function($item) use ($type) { |
|
248 | 248 | return $item['type'] == $type; |
249 | 249 | }); |
250 | 250 | } |
@@ -261,8 +261,8 @@ discard block |
||
261 | 261 | |
262 | 262 | public function sync($type, $fields, $attributes) |
263 | 263 | { |
264 | - if (! empty($this->{$type})) { |
|
265 | - $this->{$type} = array_map(function ($field) use ($fields, $attributes) { |
|
264 | + if (!empty($this->{$type})) { |
|
265 | + $this->{$type} = array_map(function($field) use ($fields, $attributes) { |
|
266 | 266 | if (in_array($field['name'], (array) $fields)) { |
267 | 267 | $field = array_merge($field, $attributes); |
268 | 268 | } |
@@ -294,15 +294,15 @@ discard block |
||
294 | 294 | { |
295 | 295 | $relationArray = explode('.', $relationString); |
296 | 296 | |
297 | - if (! isset($length)) { |
|
297 | + if (!isset($length)) { |
|
298 | 298 | $length = count($relationArray); |
299 | 299 | } |
300 | 300 | |
301 | - if (! isset($model)) { |
|
301 | + if (!isset($model)) { |
|
302 | 302 | $model = $this->model; |
303 | 303 | } |
304 | 304 | |
305 | - $result = array_reduce(array_splice($relationArray, 0, $length), function ($obj, $method) { |
|
305 | + $result = array_reduce(array_splice($relationArray, 0, $length), function($obj, $method) { |
|
306 | 306 | return $obj->$method()->getRelated(); |
307 | 307 | }, $model); |
308 | 308 | |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | $relation = $model->{$firstRelationName}; |
353 | 353 | |
354 | 354 | $results = []; |
355 | - if (! empty($relation)) { |
|
355 | + if (!empty($relation)) { |
|
356 | 356 | if ($relation instanceof Collection) { |
357 | 357 | $currentResults = $relation->toArray(); |
358 | 358 | } else { |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | |
362 | 362 | array_shift($relationArray); |
363 | 363 | |
364 | - if (! empty($relationArray)) { |
|
364 | + if (!empty($relationArray)) { |
|
365 | 365 | foreach ($currentResults as $currentResult) { |
366 | 366 | $results = array_merge($results, $this->getRelationModelInstances($currentResult, implode('.', $relationArray))); |
367 | 367 | } |
@@ -31,28 +31,28 @@ discard block |
||
31 | 31 | |
32 | 32 | // if this is a relation type field and no corresponding model was specified, get it from the relation method |
33 | 33 | // defined in the main model |
34 | - if (isset($completeFieldsArray['entity']) && ! isset($completeFieldsArray['model'])) { |
|
34 | + if (isset($completeFieldsArray['entity']) && !isset($completeFieldsArray['model'])) { |
|
35 | 35 | $completeFieldsArray['model'] = $this->getRelationModel($completeFieldsArray['entity']); |
36 | 36 | } |
37 | 37 | |
38 | 38 | // if the label is missing, we should set it |
39 | - if (! isset($completeFieldsArray['label'])) { |
|
39 | + if (!isset($completeFieldsArray['label'])) { |
|
40 | 40 | $completeFieldsArray['label'] = mb_ucfirst(str_replace('_', ' ', $completeFieldsArray['name'])); |
41 | 41 | } |
42 | 42 | |
43 | 43 | // if the field type is missing, we should set it |
44 | - if (! isset($completeFieldsArray['type'])) { |
|
44 | + if (!isset($completeFieldsArray['type'])) { |
|
45 | 45 | $completeFieldsArray['type'] = $this->getFieldTypeFromDbColumnType($completeFieldsArray['name']); |
46 | 46 | } |
47 | 47 | |
48 | 48 | // if a tab was mentioned, we should enable it |
49 | 49 | if (isset($completeFieldsArray['tab'])) { |
50 | - if (! $this->tabsEnabled()) { |
|
50 | + if (!$this->tabsEnabled()) { |
|
51 | 51 | $this->enableTabs(); |
52 | 52 | } |
53 | 53 | } |
54 | 54 | |
55 | - $this->transformFields($form, function ($fields) use ($completeFieldsArray) { |
|
55 | + $this->transformFields($form, function($fields) use ($completeFieldsArray) { |
|
56 | 56 | $fields[$completeFieldsArray['name']] = $completeFieldsArray; |
57 | 57 | |
58 | 58 | return $fields; |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public function afterField($targetFieldName, $form = 'both') |
86 | 86 | { |
87 | - $this->transformFields($form, function ($fields) use ($targetFieldName) { |
|
87 | + $this->transformFields($form, function($fields) use ($targetFieldName) { |
|
88 | 88 | return $this->moveField($fields, $targetFieldName, false); |
89 | 89 | }); |
90 | 90 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | */ |
98 | 98 | public function beforeField($targetFieldName, $form = 'both') |
99 | 99 | { |
100 | - $this->transformFields($form, function ($fields) use ($targetFieldName) { |
|
100 | + $this->transformFields($form, function($fields) use ($targetFieldName) { |
|
101 | 101 | return $this->moveField($fields, $targetFieldName, true); |
102 | 102 | }); |
103 | 103 | } |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | */ |
141 | 141 | public function removeField($name, $form = 'both') |
142 | 142 | { |
143 | - $this->transformFields($form, function ($fields) use ($name) { |
|
143 | + $this->transformFields($form, function($fields) use ($name) { |
|
144 | 144 | array_forget($fields, $name); |
145 | 145 | |
146 | 146 | return $fields; |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | */ |
156 | 156 | public function removeFields($array_of_names, $form = 'both') |
157 | 157 | { |
158 | - if (! empty($array_of_names)) { |
|
158 | + if (!empty($array_of_names)) { |
|
159 | 159 | foreach ($array_of_names as $name) { |
160 | 160 | $this->removeField($name, $form); |
161 | 161 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | public function removeAllFields($form = 'both') |
171 | 171 | { |
172 | 172 | $current_fields = $this->getCurrentFields(); |
173 | - if (! empty($current_fields)) { |
|
173 | + if (!empty($current_fields)) { |
|
174 | 174 | foreach ($current_fields as $field) { |
175 | 175 | $this->removeField($field['name'], $form); |
176 | 176 | } |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | $jsonCastables = ['array', 'object', 'json']; |
261 | 261 | $fieldCasting = $casted_attributes[$field['name']]; |
262 | 262 | |
263 | - if (in_array($fieldCasting, $jsonCastables) && isset($data[$field['name']]) && ! empty($data[$field['name']]) && ! is_array($data[$field['name']])) { |
|
263 | + if (in_array($fieldCasting, $jsonCastables) && isset($data[$field['name']]) && !empty($data[$field['name']]) && !is_array($data[$field['name']])) { |
|
264 | 264 | try { |
265 | 265 | $data[$field['name']] = json_decode($data[$field['name']]); |
266 | 266 | } catch (\Exception $e) { |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | */ |
295 | 295 | public function orderFields($order, $form = 'both') |
296 | 296 | { |
297 | - $this->transformFields($form, function ($fields) use ($order) { |
|
297 | + $this->transformFields($form, function($fields) use ($order) { |
|
298 | 298 | return $this->applyOrderToFields($fields, $order); |
299 | 299 | }); |
300 | 300 | } |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | public function hasUploadFields($form, $id = false) |
413 | 413 | { |
414 | 414 | $fields = $this->getFields($form, $id); |
415 | - $upload_fields = array_where($fields, function ($value, $key) { |
|
415 | + $upload_fields = array_where($fields, function($value, $key) { |
|
416 | 416 | return isset($value['upload']) && $value['upload'] == true; |
417 | 417 | }); |
418 | 418 |
@@ -48,7 +48,7 @@ |
||
48 | 48 | */ |
49 | 49 | public function isRequired($inputName, $operation) |
50 | 50 | { |
51 | - if (! $this->has($operation.'.requiredFields')) { |
|
51 | + if (!$this->has($operation.'.requiredFields')) { |
|
52 | 52 | return false; |
53 | 53 | } |
54 | 54 |