We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -2,8 +2,8 @@ |
||
2 | 2 | |
3 | 3 | namespace Backpack\CRUD\app\Http\Requests; |
4 | 4 | |
5 | -use Illuminate\Support\Facades\Hash; |
|
6 | 5 | use Illuminate\Foundation\Http\FormRequest; |
6 | +use Illuminate\Support\Facades\Hash; |
|
7 | 7 | |
8 | 8 | class ChangePasswordRequest extends FormRequest |
9 | 9 | { |
@@ -41,9 +41,9 @@ |
||
41 | 41 | */ |
42 | 42 | public function withValidator($validator) |
43 | 43 | { |
44 | - $validator->after(function ($validator) { |
|
44 | + $validator->after(function($validator) { |
|
45 | 45 | // check old password matches |
46 | - if (! Hash::check($this->input('old_password'), backpack_auth()->user()->password)) { |
|
46 | + if (!Hash::check($this->input('old_password'), backpack_auth()->user()->password)) { |
|
47 | 47 | $validator->errors()->add('old_password', trans('backpack::base.old_password_incorrect')); |
48 | 48 | } |
49 | 49 | }); |
@@ -2,33 +2,33 @@ |
||
2 | 2 | |
3 | 3 | namespace Backpack\CRUD\app\Library\CrudPanel; |
4 | 4 | |
5 | -use Illuminate\Database\Eloquent\Collection; |
|
6 | -use Backpack\CRUD\app\Library\CrudPanel\Traits\Read; |
|
7 | -use Backpack\CRUD\app\Library\CrudPanel\Traits\Tabs; |
|
8 | -use Backpack\CRUD\app\Library\CrudPanel\Traits\Query; |
|
9 | -use Backpack\CRUD\app\Library\CrudPanel\Traits\Views; |
|
10 | 5 | use Backpack\CRUD\app\Library\CrudPanel\Traits\Access; |
6 | +use Backpack\CRUD\app\Library\CrudPanel\Traits\AutoFocus; |
|
7 | +use Backpack\CRUD\app\Library\CrudPanel\Traits\AutoSet; |
|
8 | +use Backpack\CRUD\app\Library\CrudPanel\Traits\Buttons; |
|
9 | +use Backpack\CRUD\app\Library\CrudPanel\Traits\Columns; |
|
11 | 10 | use Backpack\CRUD\app\Library\CrudPanel\Traits\Create; |
12 | 11 | use Backpack\CRUD\app\Library\CrudPanel\Traits\Delete; |
13 | 12 | use Backpack\CRUD\app\Library\CrudPanel\Traits\Errors; |
13 | +use Backpack\CRUD\app\Library\CrudPanel\Traits\FakeColumns; |
|
14 | +use Backpack\CRUD\app\Library\CrudPanel\Traits\FakeFields; |
|
14 | 15 | use Backpack\CRUD\app\Library\CrudPanel\Traits\Fields; |
15 | -use Backpack\CRUD\app\Library\CrudPanel\Traits\Search; |
|
16 | -use Backpack\CRUD\app\Library\CrudPanel\Traits\Update; |
|
17 | -use Backpack\CRUD\app\Library\CrudPanel\Traits\AutoSet; |
|
18 | -use Backpack\CRUD\app\Library\CrudPanel\Traits\Buttons; |
|
19 | -use Backpack\CRUD\app\Library\CrudPanel\Traits\Columns; |
|
20 | 16 | use Backpack\CRUD\app\Library\CrudPanel\Traits\Filters; |
21 | -use Backpack\CRUD\app\Library\CrudPanel\Traits\Reorder; |
|
22 | -use Backpack\CRUD\app\Library\CrudPanel\Traits\Settings; |
|
23 | -use Backpack\CRUD\app\Library\CrudPanel\Traits\AutoFocus; |
|
17 | +use Backpack\CRUD\app\Library\CrudPanel\Traits\HeadingsAndTitles; |
|
24 | 18 | use Backpack\CRUD\app\Library\CrudPanel\Traits\Macroable; |
25 | -use Backpack\CRUD\app\Library\CrudPanel\Traits\FakeFields; |
|
26 | 19 | use Backpack\CRUD\app\Library\CrudPanel\Traits\Operations; |
27 | -use Backpack\CRUD\app\Library\CrudPanel\Traits\Validation; |
|
28 | -use Backpack\CRUD\app\Library\CrudPanel\Traits\FakeColumns; |
|
20 | +use Backpack\CRUD\app\Library\CrudPanel\Traits\Query; |
|
21 | +use Backpack\CRUD\app\Library\CrudPanel\Traits\Read; |
|
22 | +use Backpack\CRUD\app\Library\CrudPanel\Traits\Reorder; |
|
29 | 23 | use Backpack\CRUD\app\Library\CrudPanel\Traits\SaveActions; |
30 | -use Backpack\CRUD\app\Library\CrudPanel\Traits\HeadingsAndTitles; |
|
24 | +use Backpack\CRUD\app\Library\CrudPanel\Traits\Search; |
|
25 | +use Backpack\CRUD\app\Library\CrudPanel\Traits\Settings; |
|
26 | +use Backpack\CRUD\app\Library\CrudPanel\Traits\Tabs; |
|
27 | +use Backpack\CRUD\app\Library\CrudPanel\Traits\Update; |
|
28 | +use Backpack\CRUD\app\Library\CrudPanel\Traits\Validation; |
|
29 | +use Backpack\CRUD\app\Library\CrudPanel\Traits\Views; |
|
31 | 30 | use Backpack\CRUD\app\Library\CrudPanel\Traits\ViewsAndRestoresRevisions; |
31 | +use Illuminate\Database\Eloquent\Collection; |
|
32 | 32 | |
33 | 33 | class CrudPanel |
34 | 34 | { |
@@ -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 | } |
@@ -12,6 +12,9 @@ |
||
12 | 12 | return $this->getOperationSetting('autoFocusOnFirstField'); |
13 | 13 | } |
14 | 14 | |
15 | + /** |
|
16 | + * @param boolean $value |
|
17 | + */ |
|
15 | 18 | public function setAutoFocusOnFirstField($value) |
16 | 19 | { |
17 | 20 | return $this->setOperationSetting('autoFocusOnFirstField', (bool) $value); |
@@ -159,7 +159,7 @@ |
||
159 | 159 | * @param \Illuminate\Database\Eloquent\Model $item The current CRUD model. |
160 | 160 | * @param array $formattedData The form data. |
161 | 161 | * |
162 | - * @return bool|null |
|
162 | + * @return false|null |
|
163 | 163 | */ |
164 | 164 | private function createRelationsForItem($item, $formattedData) |
165 | 165 | { |
@@ -2,8 +2,8 @@ |
||
2 | 2 | |
3 | 3 | namespace Backpack\CRUD\app\Library\CrudPanel\Traits; |
4 | 4 | |
5 | -use Illuminate\Database\Eloquent\Relations\HasOne; |
|
6 | 5 | use Illuminate\Database\Eloquent\Relations\BelongsTo; |
6 | +use Illuminate\Database\Eloquent\Relations\HasOne; |
|
7 | 7 | |
8 | 8 | trait Create |
9 | 9 | { |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | { |
82 | 82 | $all_relation_fields = $this->getRelationFields(); |
83 | 83 | |
84 | - return array_where($all_relation_fields, function ($value, $key) { |
|
84 | + return array_where($all_relation_fields, function($value, $key) { |
|
85 | 85 | return isset($value['pivot']) && $value['pivot']; |
86 | 86 | }); |
87 | 87 | } |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | private function createRelationsForItem($item, $formattedData) |
158 | 158 | { |
159 | - if (! isset($formattedData['relations'])) { |
|
159 | + if (!isset($formattedData['relations'])) { |
|
160 | 160 | return false; |
161 | 161 | } |
162 | 162 | |
@@ -213,11 +213,11 @@ discard block |
||
213 | 213 | $key = implode('.relations.', explode('.', $relationField['entity'])); |
214 | 214 | $fieldData = array_get($relationData, 'relations.'.$key, []); |
215 | 215 | |
216 | - if (! array_key_exists('model', $fieldData)) { |
|
216 | + if (!array_key_exists('model', $fieldData)) { |
|
217 | 217 | $fieldData['model'] = $relationField['model']; |
218 | 218 | } |
219 | 219 | |
220 | - if (! array_key_exists('parent', $fieldData)) { |
|
220 | + if (!array_key_exists('parent', $fieldData)) { |
|
221 | 221 | $fieldData['parent'] = $this->getRelationModel($relationField['entity'], -1); |
222 | 222 | } |
223 | 223 |
@@ -15,7 +15,7 @@ |
||
15 | 15 | * |
16 | 16 | * @param int $id The id of the item to be deleted. |
17 | 17 | * |
18 | - * @return bool True if the item was deleted. |
|
18 | + * @return string True if the item was deleted. |
|
19 | 19 | * |
20 | 20 | * @throws \Illuminate\Database\Eloquent\ModelNotFoundException if the model was not found. |
21 | 21 | * |
@@ -10,8 +10,6 @@ |
||
10 | 10 | * plus the '_token' and 'redirect_after_save' variables. |
11 | 11 | * |
12 | 12 | * @param array $requestInput The request input. |
13 | - * @param string $form The CRUD form. Can be 'create' or 'update' . Default is 'create'. |
|
14 | - * @param int|bool $id The CRUD entry id in the case of the 'update' form. |
|
15 | 13 | * |
16 | 14 | * @see \Illuminate\Http\Request::all() For an example on how to get the request input. |
17 | 15 | * |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | $fakeFieldKey = isset($field['store_in']) ? $field['store_in'] : 'extras'; |
30 | 30 | $this->addCompactedField($requestInput, $field['name'], $fakeFieldKey); |
31 | 31 | |
32 | - if (! in_array($fakeFieldKey, $compactedFakeFields)) { |
|
32 | + if (!in_array($fakeFieldKey, $compactedFakeFields)) { |
|
33 | 33 | $compactedFakeFields[] = $fakeFieldKey; |
34 | 34 | } |
35 | 35 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | |
38 | 38 | // json_encode all fake_value columns if applicable in the database, so they can be properly stored and interpreted |
39 | 39 | foreach ($compactedFakeFields as $value) { |
40 | - if (! (property_exists($this->model, 'translatable') && in_array($value, $this->model->getTranslatableAttributes(), true)) && $this->model->shouldEncodeFake($value)) { |
|
40 | + if (!(property_exists($this->model, 'translatable') && in_array($value, $this->model->getTranslatableAttributes(), true)) && $this->model->shouldEncodeFake($value)) { |
|
41 | 41 | $requestInput[$value] = json_encode($requestInput[$value]); |
42 | 42 | } |
43 | 43 | } |
@@ -22,7 +22,6 @@ discard block |
||
22 | 22 | * Add a field to the create/update form or both. |
23 | 23 | * |
24 | 24 | * @param string|array $field The new field. |
25 | - * @param string $form The CRUD form. Can be 'create', 'update' or 'both'. Default is 'both'. |
|
26 | 25 | * |
27 | 26 | * @return self |
28 | 27 | */ |
@@ -70,7 +69,6 @@ discard block |
||
70 | 69 | * Add multiple fields to the create/update form or both. |
71 | 70 | * |
72 | 71 | * @param array $fields The new fields. |
73 | - * @param string $form The CRUD form. Can be 'create', 'update' or 'both'. Default is 'both'. |
|
74 | 72 | */ |
75 | 73 | public function addFields($fields) |
76 | 74 | { |
@@ -85,7 +83,6 @@ discard block |
||
85 | 83 | * Move the most recently added field after the given target field. |
86 | 84 | * |
87 | 85 | * @param string $targetFieldName The target field name. |
88 | - * @param string $form The CRUD form. Can be 'create', 'update' or 'both'. Default is 'both'. |
|
89 | 86 | */ |
90 | 87 | public function afterField($targetFieldName) |
91 | 88 | { |
@@ -98,7 +95,6 @@ discard block |
||
98 | 95 | * Move the most recently added field before the given target field. |
99 | 96 | * |
100 | 97 | * @param string $targetFieldName The target field name. |
101 | - * @param string $form The CRUD form. Can be 'create', 'update' or 'both'. Default is 'both'. |
|
102 | 98 | */ |
103 | 99 | public function beforeField($targetFieldName) |
104 | 100 | { |
@@ -141,7 +137,6 @@ discard block |
||
141 | 137 | * Remove a certain field from the create/update/both forms by its name. |
142 | 138 | * |
143 | 139 | * @param string $name Field name (as defined with the addField() procedure) |
144 | - * @param string $form update/create/both |
|
145 | 140 | */ |
146 | 141 | public function removeField($name) |
147 | 142 | { |
@@ -330,8 +325,6 @@ discard block |
||
330 | 325 | * Check if the create/update form has upload fields. |
331 | 326 | * Upload fields are the ones that have "upload" => true defined on them. |
332 | 327 | * |
333 | - * @param string $form create/update/both - defaults to 'both' |
|
334 | - * @param bool|int $id id of the entity - defaults to false |
|
335 | 328 | * |
336 | 329 | * @return bool |
337 | 330 | */ |
@@ -38,23 +38,23 @@ discard block |
||
38 | 38 | |
39 | 39 | // if this is a relation type field and no corresponding model was specified, get it from the relation method |
40 | 40 | // defined in the main model |
41 | - if (isset($newField['entity']) && ! isset($newField['model'])) { |
|
41 | + if (isset($newField['entity']) && !isset($newField['model'])) { |
|
42 | 42 | $newField['model'] = $this->getRelationModel($newField['entity']); |
43 | 43 | } |
44 | 44 | |
45 | 45 | // if the label is missing, we should set it |
46 | - if (! isset($newField['label'])) { |
|
46 | + if (!isset($newField['label'])) { |
|
47 | 47 | $newField['label'] = mb_ucfirst(str_replace('_', ' ', $newField['name'])); |
48 | 48 | } |
49 | 49 | |
50 | 50 | // if the field type is missing, we should set it |
51 | - if (! isset($newField['type'])) { |
|
51 | + if (!isset($newField['type'])) { |
|
52 | 52 | $newField['type'] = $this->getFieldTypeFromDbColumnType($newField['name']); |
53 | 53 | } |
54 | 54 | |
55 | 55 | // if a tab was mentioned, we should enable it |
56 | 56 | if (isset($newField['tab'])) { |
57 | - if (! $this->tabsEnabled()) { |
|
57 | + if (!$this->tabsEnabled()) { |
|
58 | 58 | $this->enableTabs(); |
59 | 59 | } |
60 | 60 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | */ |
90 | 90 | public function afterField($targetFieldName) |
91 | 91 | { |
92 | - $this->transformFields(function ($fields) use ($targetFieldName) { |
|
92 | + $this->transformFields(function($fields) use ($targetFieldName) { |
|
93 | 93 | return $this->moveField($fields, $targetFieldName, false); |
94 | 94 | }); |
95 | 95 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function beforeField($targetFieldName) |
104 | 104 | { |
105 | - $this->transformFields(function ($fields) use ($targetFieldName) { |
|
105 | + $this->transformFields(function($fields) use ($targetFieldName) { |
|
106 | 106 | return $this->moveField($fields, $targetFieldName, true); |
107 | 107 | }); |
108 | 108 | } |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | */ |
146 | 146 | public function removeField($name) |
147 | 147 | { |
148 | - $this->transformFields(function ($fields) use ($name) { |
|
148 | + $this->transformFields(function($fields) use ($name) { |
|
149 | 149 | array_forget($fields, $name); |
150 | 150 | |
151 | 151 | return $fields; |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | */ |
160 | 160 | public function removeFields($array_of_names) |
161 | 161 | { |
162 | - if (! empty($array_of_names)) { |
|
162 | + if (!empty($array_of_names)) { |
|
163 | 163 | foreach ($array_of_names as $name) { |
164 | 164 | $this->removeField($name); |
165 | 165 | } |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | public function removeAllFields() |
173 | 173 | { |
174 | 174 | $current_fields = $this->getCurrentFields(); |
175 | - if (! empty($current_fields)) { |
|
175 | + if (!empty($current_fields)) { |
|
176 | 176 | foreach ($current_fields as $field) { |
177 | 177 | $this->removeField($field['name']); |
178 | 178 | } |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | $jsonCastables = ['array', 'object', 'json']; |
247 | 247 | $fieldCasting = $casted_attributes[$field['name']]; |
248 | 248 | |
249 | - if (in_array($fieldCasting, $jsonCastables) && isset($data[$field['name']]) && ! empty($data[$field['name']]) && ! is_array($data[$field['name']])) { |
|
249 | + if (in_array($fieldCasting, $jsonCastables) && isset($data[$field['name']]) && !empty($data[$field['name']]) && !is_array($data[$field['name']])) { |
|
250 | 250 | try { |
251 | 251 | $data[$field['name']] = json_decode($data[$field['name']]); |
252 | 252 | } catch (\Exception $e) { |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | */ |
276 | 276 | public function orderFields($order) |
277 | 277 | { |
278 | - $this->transformFields(function ($fields) use ($order) { |
|
278 | + $this->transformFields(function($fields) use ($order) { |
|
279 | 279 | return $this->applyOrderToFields($fields, $order); |
280 | 280 | }); |
281 | 281 | } |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | public function hasUploadFields() |
339 | 339 | { |
340 | 340 | $fields = $this->getFields(); |
341 | - $upload_fields = array_where($fields, function ($value, $key) { |
|
341 | + $upload_fields = array_where($fields, function($value, $key) { |
|
342 | 342 | return isset($value['upload']) && $value['upload'] == true; |
343 | 343 | }); |
344 | 344 |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | /** |
57 | 57 | * Convenience method to make sure all calls are made to a particular operation. |
58 | 58 | * |
59 | - * @param string|array $operation Operation name in string form |
|
59 | + * @param string|array $operations Operation name in string form |
|
60 | 60 | * @param bool|\Closure $closure Code that calls CrudPanel methods. |
61 | 61 | * @return void |
62 | 62 | */ |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * Allc configurations are put inside that operation's namespace. |
71 | 71 | * Ex: show.configuration. |
72 | 72 | * |
73 | - * @param string|array $operation Operation name in string form |
|
73 | + * @param string|array $operations Operation name in string form |
|
74 | 74 | * @param bool|\Closure $closure Code that calls CrudPanel methods. |
75 | 75 | * @return void |
76 | 76 | */ |
@@ -62,7 +62,7 @@ |
||
62 | 62 | * Order results of the query in a custom way. |
63 | 63 | * |
64 | 64 | * @param array $column Column array with all attributes |
65 | - * @param string $column_direction ASC or DESC |
|
65 | + * @param string $columnDirection ASC or DESC |
|
66 | 66 | * |
67 | 67 | * @return \Illuminate\Database\Eloquent\Builder |
68 | 68 | */ |
@@ -68,7 +68,7 @@ |
||
68 | 68 | */ |
69 | 69 | public function customOrderBy($column, $columnDirection = 'asc') |
70 | 70 | { |
71 | - if (! isset($column['orderLogic'])) { |
|
71 | + if (!isset($column['orderLogic'])) { |
|
72 | 72 | return $this->query; |
73 | 73 | } |
74 | 74 |