We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -90,11 +90,11 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public function setModel($model_namespace) |
92 | 92 | { |
93 | - if (! class_exists($model_namespace)) { |
|
93 | + if (!class_exists($model_namespace)) { |
|
94 | 94 | throw new \Exception('The model does not exist.', 500); |
95 | 95 | } |
96 | 96 | |
97 | - if (! method_exists($model_namespace, 'hasCrudTrait')) { |
|
97 | + if (!method_exists($model_namespace, 'hasCrudTrait')) { |
|
98 | 98 | throw new \Exception('Please use CrudTrait on the model.', 500); |
99 | 99 | } |
100 | 100 | |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | { |
148 | 148 | $complete_route = $route.'.index'; |
149 | 149 | |
150 | - if (! \Route::has($complete_route)) { |
|
150 | + if (!\Route::has($complete_route)) { |
|
151 | 151 | throw new \Exception('There are no routes for this route name.', 404); |
152 | 152 | } |
153 | 153 | |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | */ |
249 | 249 | public function getFirstOfItsTypeInArray($type, $array) |
250 | 250 | { |
251 | - return array_first($array, function ($item) use ($type) { |
|
251 | + return array_first($array, function($item) use ($type) { |
|
252 | 252 | return $item['type'] == $type; |
253 | 253 | }); |
254 | 254 | } |
@@ -265,8 +265,8 @@ discard block |
||
265 | 265 | |
266 | 266 | public function sync($type, $fields, $attributes) |
267 | 267 | { |
268 | - if (! empty($this->{$type})) { |
|
269 | - $this->{$type} = array_map(function ($field) use ($fields, $attributes) { |
|
268 | + if (!empty($this->{$type})) { |
|
269 | + $this->{$type} = array_map(function($field) use ($fields, $attributes) { |
|
270 | 270 | if (in_array($field['name'], (array) $fields)) { |
271 | 271 | $field = array_merge($field, $attributes); |
272 | 272 | } |
@@ -298,8 +298,8 @@ discard block |
||
298 | 298 | } |
299 | 299 | } |
300 | 300 | |
301 | - return $this->{$items} = array_merge($elements, array_filter($this->{$items}, function ($item) use ($items) { |
|
302 | - return ! in_array($item['name'], $this->sort[$items]); |
|
301 | + return $this->{$items} = array_merge($elements, array_filter($this->{$items}, function($item) use ($items) { |
|
302 | + return !in_array($item['name'], $this->sort[$items]); |
|
303 | 303 | })); |
304 | 304 | } |
305 | 305 | |
@@ -328,15 +328,15 @@ discard block |
||
328 | 328 | { |
329 | 329 | $relationArray = explode('.', $relationString); |
330 | 330 | |
331 | - if (! isset($length)) { |
|
331 | + if (!isset($length)) { |
|
332 | 332 | $length = count($relationArray); |
333 | 333 | } |
334 | 334 | |
335 | - if (! isset($model)) { |
|
335 | + if (!isset($model)) { |
|
336 | 336 | $model = $this->model; |
337 | 337 | } |
338 | 338 | |
339 | - $result = array_reduce(array_splice($relationArray, 0, $length), function ($obj, $method) { |
|
339 | + $result = array_reduce(array_splice($relationArray, 0, $length), function($obj, $method) { |
|
340 | 340 | return $obj->$method()->getRelated(); |
341 | 341 | }, $model); |
342 | 342 | |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | $relation = $model->{$firstRelationName}; |
387 | 387 | |
388 | 388 | $results = []; |
389 | - if (! empty($relation)) { |
|
389 | + if (!empty($relation)) { |
|
390 | 390 | if ($relation instanceof Collection) { |
391 | 391 | $currentResults = $relation->toArray(); |
392 | 392 | } else { |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | |
396 | 396 | array_shift($relationArray); |
397 | 397 | |
398 | - if (! empty($relationArray)) { |
|
398 | + if (!empty($relationArray)) { |
|
399 | 399 | foreach ($currentResults as $currentResult) { |
400 | 400 | $results = array_merge($results, $this->getRelationModelInstances($currentResult, implode('.', $relationArray))); |
401 | 401 | } |
@@ -2,31 +2,31 @@ |
||
2 | 2 | |
3 | 3 | namespace Backpack\CRUD; |
4 | 4 | |
5 | -use Backpack\CRUD\PanelTraits\Read; |
|
6 | -use Backpack\CRUD\PanelTraits\Tabs; |
|
7 | -use Backpack\CRUD\PanelTraits\Query; |
|
8 | -use Backpack\CRUD\PanelTraits\Views; |
|
9 | 5 | use Backpack\CRUD\PanelTraits\Access; |
6 | +use Backpack\CRUD\PanelTraits\AutoFocus; |
|
7 | +use Backpack\CRUD\PanelTraits\AutoSet; |
|
8 | +use Backpack\CRUD\PanelTraits\Buttons; |
|
9 | +use Backpack\CRUD\PanelTraits\Columns; |
|
10 | 10 | use Backpack\CRUD\PanelTraits\Create; |
11 | 11 | use Backpack\CRUD\PanelTraits\Delete; |
12 | 12 | use Backpack\CRUD\PanelTraits\Errors; |
13 | +use Backpack\CRUD\PanelTraits\FakeColumns; |
|
14 | +use Backpack\CRUD\PanelTraits\FakeFields; |
|
13 | 15 | use Backpack\CRUD\PanelTraits\Fields; |
14 | -use Backpack\CRUD\PanelTraits\Search; |
|
15 | -use Backpack\CRUD\PanelTraits\Update; |
|
16 | -use Backpack\CRUD\PanelTraits\AutoSet; |
|
17 | -use Backpack\CRUD\PanelTraits\Buttons; |
|
18 | -use Backpack\CRUD\PanelTraits\Columns; |
|
19 | 16 | use Backpack\CRUD\PanelTraits\Filters; |
20 | -use Backpack\CRUD\PanelTraits\Reorder; |
|
21 | -use Backpack\CRUD\PanelTraits\AutoFocus; |
|
17 | +use Backpack\CRUD\PanelTraits\HeadingsAndTitle; |
|
22 | 18 | use Backpack\CRUD\PanelTraits\Macroable; |
23 | -use Backpack\CRUD\PanelTraits\FakeFields; |
|
24 | 19 | use Backpack\CRUD\PanelTraits\Operations; |
25 | -use Backpack\CRUD\PanelTraits\FakeColumns; |
|
26 | -use Illuminate\Database\Eloquent\Collection; |
|
20 | +use Backpack\CRUD\PanelTraits\Query; |
|
21 | +use Backpack\CRUD\PanelTraits\Read; |
|
22 | +use Backpack\CRUD\PanelTraits\Reorder; |
|
27 | 23 | use Backpack\CRUD\PanelTraits\RequiredFields; |
28 | -use Backpack\CRUD\PanelTraits\HeadingsAndTitle; |
|
24 | +use Backpack\CRUD\PanelTraits\Search; |
|
25 | +use Backpack\CRUD\PanelTraits\Tabs; |
|
26 | +use Backpack\CRUD\PanelTraits\Update; |
|
27 | +use Backpack\CRUD\PanelTraits\Views; |
|
29 | 28 | use Backpack\CRUD\PanelTraits\ViewsAndRestoresRevisions; |
29 | +use Illuminate\Database\Eloquent\Collection; |
|
30 | 30 | |
31 | 31 | class CrudPanel |
32 | 32 | { |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | |
158 | 158 | /** |
159 | 159 | * Sets the edit content class. |
160 | - * @param string $editContentClass content class |
|
160 | + * @param string $showContentClass content class |
|
161 | 161 | */ |
162 | 162 | public function setShowContentClass(string $showContentClass) |
163 | 163 | { |
@@ -332,6 +332,9 @@ discard block |
||
332 | 332 | return $this->getShowView(); |
333 | 333 | } |
334 | 334 | |
335 | + /** |
|
336 | + * @param string $view |
|
337 | + */ |
|
335 | 338 | public function setPreviewView($view) |
336 | 339 | { |
337 | 340 | return $this->setShowView($view); |
@@ -342,6 +345,9 @@ discard block |
||
342 | 345 | return $this->getEditView(); |
343 | 346 | } |
344 | 347 | |
348 | + /** |
|
349 | + * @param string $view |
|
350 | + */ |
|
345 | 351 | public function setUpdateView($view) |
346 | 352 | { |
347 | 353 | return $this->setEditView($view); |
@@ -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 |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * |
10 | 10 | * @param int $id |
11 | 11 | * |
12 | - * @return Response |
|
12 | + * @return string |
|
13 | 13 | */ |
14 | 14 | public function clone($id) |
15 | 15 | { |
@@ -23,7 +23,6 @@ discard block |
||
23 | 23 | /** |
24 | 24 | * Create duplicates of multiple entries in the datatabase. |
25 | 25 | * |
26 | - * @param int $id |
|
27 | 26 | * |
28 | 27 | * @return Response |
29 | 28 | */ |
@@ -16,7 +16,7 @@ |
||
16 | 16 | $this->crud->hasAccessOrFail('reorder'); |
17 | 17 | $this->crud->setOperation('reorder'); |
18 | 18 | |
19 | - if (! $this->crud->isReorderEnabled()) { |
|
19 | + if (!$this->crud->isReorderEnabled()) { |
|
20 | 20 | abort(403, 'Reorder is disabled.'); |
21 | 21 | } |
22 | 22 |
@@ -46,7 +46,7 @@ |
||
46 | 46 | $this->crud->setOperation('revisions'); |
47 | 47 | |
48 | 48 | $revisionId = \Request::input('revision_id', false); |
49 | - if (! $revisionId) { |
|
49 | + if (!$revisionId) { |
|
50 | 50 | abort(500, 'Can\'t restore revision without revision_id'); |
51 | 51 | } else { |
52 | 52 | $this->crud->restoreRevision($id, $revisionId); // do the update |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | */ |
109 | 109 | $button = $this->buttons()->firstWhere('name', $name); |
110 | 110 | |
111 | - if (! $button) { |
|
111 | + if (!$button) { |
|
112 | 112 | abort(500, 'CRUD Button "'.$name.'" not found. Please check the button exists before you modify it.'); |
113 | 113 | } |
114 | 114 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | */ |
130 | 130 | public function removeButton($name, $stack = null) |
131 | 131 | { |
132 | - $this->buttons = $this->buttons->reject(function ($button) use ($name, $stack) { |
|
132 | + $this->buttons = $this->buttons->reject(function($button) use ($name, $stack) { |
|
133 | 133 | return $stack == null ? $button->name == $name : ($button->stack == $stack) && ($button->name == $name); |
134 | 134 | }); |
135 | 135 | } |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | */ |
141 | 141 | public function removeButtons($names, $stack = null) |
142 | 142 | { |
143 | - if (! empty($names)) { |
|
143 | + if (!empty($names)) { |
|
144 | 144 | foreach ($names as $name) { |
145 | 145 | $this->removeButton($name, $stack); |
146 | 146 | } |
@@ -154,14 +154,14 @@ discard block |
||
154 | 154 | |
155 | 155 | public function removeAllButtonsFromStack($stack) |
156 | 156 | { |
157 | - $this->buttons = $this->buttons->reject(function ($button) use ($stack) { |
|
157 | + $this->buttons = $this->buttons->reject(function($button) use ($stack) { |
|
158 | 158 | return $button->stack == $stack; |
159 | 159 | }); |
160 | 160 | } |
161 | 161 | |
162 | 162 | public function removeButtonFromStack($name, $stack) |
163 | 163 | { |
164 | - $this->buttons = $this->buttons->reject(function ($button) use ($name, $stack) { |
|
164 | + $this->buttons = $this->buttons->reject(function($button) use ($name, $stack) { |
|
165 | 165 | return $button->name == $name && $button->stack == $stack; |
166 | 166 | }); |
167 | 167 | } |
@@ -62,6 +62,9 @@ discard block |
||
62 | 62 | $this->addButton($stack, $name, 'model_function', $model_function_name, $position); |
63 | 63 | } |
64 | 64 | |
65 | + /** |
|
66 | + * @param string $view |
|
67 | + */ |
|
65 | 68 | public function addButtonFromView($stack, $name, $view, $position = false) |
66 | 69 | { |
67 | 70 | $view = 'crud::buttons.'.$view; |
@@ -139,6 +142,9 @@ discard block |
||
139 | 142 | $this->buttons = collect([]); |
140 | 143 | } |
141 | 144 | |
145 | + /** |
|
146 | + * @param string $stack |
|
147 | + */ |
|
142 | 148 | public function removeAllButtonsFromStack($stack) |
143 | 149 | { |
144 | 150 | $this->buttons = $this->buttons->reject(function ($button) use ($stack) { |
@@ -161,6 +167,12 @@ discard block |
||
161 | 167 | public $type = 'view'; |
162 | 168 | public $content; |
163 | 169 | |
170 | + /** |
|
171 | + * @param string $stack |
|
172 | + * @param string $name |
|
173 | + * @param string $type |
|
174 | + * @param string $content |
|
175 | + */ |
|
164 | 176 | public function __construct($stack, $name, $type, $content) |
165 | 177 | { |
166 | 178 | $this->stack = $stack; |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (! function_exists('square_brackets_to_dots')) { |
|
3 | +if (!function_exists('square_brackets_to_dots')) { |
|
4 | 4 | /** |
5 | 5 | * Turns a string from bracket-type array to dot-notation array. |
6 | 6 | * Ex: array[0][property] turns into array.0.property. |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | } |
18 | 18 | } |
19 | 19 | |
20 | -if (! function_exists('is_countable')) { |
|
20 | +if (!function_exists('is_countable')) { |
|
21 | 21 | /** |
22 | 22 | * We need this because is_countable was only introduced in PHP 7.3, |
23 | 23 | * and in PHP 7.2 you should check if count() argument is really countable. |
@@ -17,12 +17,12 @@ discard block |
||
17 | 17 | */ |
18 | 18 | public function setFromDb() |
19 | 19 | { |
20 | - if (! $this->driverIsMongoDb()) { |
|
20 | + if (!$this->driverIsMongoDb()) { |
|
21 | 21 | $this->setDoctrineTypesMapping(); |
22 | 22 | $this->getDbColumnTypes(); |
23 | 23 | } |
24 | 24 | |
25 | - array_map(function ($field) { |
|
25 | + array_map(function($field) { |
|
26 | 26 | $new_field = [ |
27 | 27 | 'name' => $field, |
28 | 28 | 'label' => $this->makeLabel($field), |
@@ -33,14 +33,14 @@ discard block |
||
33 | 33 | 'attributes' => [], |
34 | 34 | 'autoset' => true, |
35 | 35 | ]; |
36 | - if (! isset($this->create_fields[$field])) { |
|
36 | + if (!isset($this->create_fields[$field])) { |
|
37 | 37 | $this->create_fields[$field] = $new_field; |
38 | 38 | } |
39 | - if (! isset($this->update_fields[$field])) { |
|
39 | + if (!isset($this->update_fields[$field])) { |
|
40 | 40 | $this->update_fields[$field] = $new_field; |
41 | 41 | } |
42 | 42 | |
43 | - if (! in_array($field, $this->model->getHidden()) && ! isset($this->columns[$field])) { |
|
43 | + if (!in_array($field, $this->model->getHidden()) && !isset($this->columns[$field])) { |
|
44 | 44 | $this->addColumn([ |
45 | 45 | 'name' => $field, |
46 | 46 | 'label' => $this->makeLabel($field), |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | */ |
97 | 97 | public function getFieldTypeFromDbColumnType($field) |
98 | 98 | { |
99 | - if (! array_key_exists($field, $this->db_column_types)) { |
|
99 | + if (!array_key_exists($field, $this->db_column_types)) { |
|
100 | 100 | return 'text'; |
101 | 101 | } |
102 | 102 | |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | $types = ['enum' => 'string']; |
163 | 163 | $platform = $this->getSchema()->getConnection()->getDoctrineConnection()->getDatabasePlatform(); |
164 | 164 | foreach ($types as $type_key => $type_value) { |
165 | - if (! $platform->hasDoctrineTypeMappingFor($type_key)) { |
|
165 | + if (!$platform->hasDoctrineTypeMappingFor($type_key)) { |
|
166 | 166 | $platform->registerDoctrineTypeMapping($type_key, $type_value); |
167 | 167 | } |
168 | 168 | } |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | // Automatically-set columns should be both in the database, and in the $fillable variable on the Eloquent Model |
222 | 222 | $columns = $this->model->getConnection()->getSchemaBuilder()->getColumnListing($this->model->getTable()); |
223 | 223 | |
224 | - if (! empty($fillable)) { |
|
224 | + if (!empty($fillable)) { |
|
225 | 225 | $columns = array_intersect($columns, $fillable); |
226 | 226 | } |
227 | 227 | } |