We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -42,7 +42,7 @@ |
||
42 | 42 | */ |
43 | 43 | public function isRequired($inputName, $operation) |
44 | 44 | { |
45 | - if (! isset($this->requiredFields[$operation])) { |
|
45 | + if (!isset($this->requiredFields[$operation])) { |
|
46 | 46 | return false; |
47 | 47 | } |
48 | 48 |
@@ -22,11 +22,11 @@ discard block |
||
22 | 22 | |
23 | 23 | $saveOptions = collect($permissions) |
24 | 24 | // Restrict list to allowed actions. |
25 | - ->filter(function ($action, $permission) { |
|
25 | + ->filter(function($action, $permission) { |
|
26 | 26 | return $this->crud->hasAccess($permission); |
27 | 27 | }) |
28 | 28 | // Generate list of possible actions. |
29 | - ->mapWithKeys(function ($action, $permission) { |
|
29 | + ->mapWithKeys(function($action, $permission) { |
|
30 | 30 | return [$action => $this->getSaveActionButtonName($action)]; |
31 | 31 | }) |
32 | 32 | ->all(); |
@@ -61,8 +61,7 @@ discard block |
||
61 | 61 | */ |
62 | 62 | public function setSaveAction($forceSaveAction = null) |
63 | 63 | { |
64 | - $saveAction = $forceSaveAction ?: |
|
65 | - \Request::input('save_action', config('backpack.crud.default_save_action', 'save_and_back')); |
|
64 | + $saveAction = $forceSaveAction ?: \Request::input('save_action', config('backpack.crud.default_save_action', 'save_and_back')); |
|
66 | 65 | |
67 | 66 | if (config('backpack.crud.show_save_action_change', true) && |
68 | 67 | session('save_action', 'save_and_back') !== $saveAction) { |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function getTitle($action = false) |
23 | 23 | { |
24 | - if (! $action) { |
|
24 | + if (!$action) { |
|
25 | 25 | $action = $this->getActionMethod(); |
26 | 26 | } |
27 | 27 | |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | */ |
39 | 39 | public function setTitle($string, $action = false) |
40 | 40 | { |
41 | - if (! $action) { |
|
41 | + if (!$action) { |
|
42 | 42 | $action = $this->getActionMethod(); |
43 | 43 | } |
44 | 44 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public function getHeading($action = false) |
60 | 60 | { |
61 | - if (! $action) { |
|
61 | + if (!$action) { |
|
62 | 62 | $action = $this->getActionMethod(); |
63 | 63 | } |
64 | 64 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public function setHeading($string, $action = false) |
77 | 77 | { |
78 | - if (! $action) { |
|
78 | + if (!$action) { |
|
79 | 79 | $action = $this->getActionMethod(); |
80 | 80 | } |
81 | 81 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public function getSubheading($action = false) |
97 | 97 | { |
98 | - if (! $action) { |
|
98 | + if (!$action) { |
|
99 | 99 | $action = $this->getActionMethod(); |
100 | 100 | } |
101 | 101 | |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | */ |
113 | 113 | public function setSubheading($string, $action = false) |
114 | 114 | { |
115 | - if (! $action) { |
|
115 | + if (!$action) { |
|
116 | 116 | $action = $this->getActionMethod(); |
117 | 117 | } |
118 | 118 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * Check if the application is running in normal conditions |
11 | 11 | * (production env, not in console, not in unit tests). |
12 | 12 | * |
13 | - * @return void |
|
13 | + * @return boolean |
|
14 | 14 | */ |
15 | 15 | private function runningInProduction() |
16 | 16 | { |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @param string $method HTTP Method to use for the request. |
87 | 87 | * @param string $url URL to point the request at. |
88 | 88 | * @param array $payload The data you want sent to the URL. |
89 | - * @return void |
|
89 | + * @return boolean |
|
90 | 90 | */ |
91 | 91 | private function makeCurlRequest($method, $url, $payload) |
92 | 92 | { |
@@ -38,7 +38,7 @@ |
||
38 | 38 | private function sendUsageStats() |
39 | 39 | { |
40 | 40 | // only send usage stats in production |
41 | - if (! $this->runningInProduction()) { |
|
41 | + if (!$this->runningInProduction()) { |
|
42 | 42 | return; |
43 | 43 | } |
44 | 44 |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | /** |
144 | 144 | * Move the most recently added column after the given target column. |
145 | 145 | * |
146 | - * @param string|array $targetColumn The target column name or array. |
|
146 | + * @param string $targetColumn The target column name or array. |
|
147 | 147 | */ |
148 | 148 | public function afterColumn($targetColumn) |
149 | 149 | { |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | |
163 | 163 | /** |
164 | 164 | * Move this column to be first in the columns list. |
165 | - * @return bool|null |
|
165 | + * @return false|null |
|
166 | 166 | */ |
167 | 167 | public function makeFirstColumn() |
168 | 168 | { |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | /** |
282 | 282 | * Change attributes for multiple columns. |
283 | 283 | * |
284 | - * @param array $columns |
|
284 | + * @param string[] $columns |
|
285 | 285 | * @param array $attributes |
286 | 286 | */ |
287 | 287 | public function setColumnsDetails($columns, $attributes) |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | public function addColumn($column) |
69 | 69 | { |
70 | 70 | // if a string was passed, not an array, change it to an array |
71 | - if (! is_array($column)) { |
|
71 | + if (!is_array($column)) { |
|
72 | 72 | $column = ['name' => $column]; |
73 | 73 | } |
74 | 74 | |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $column_with_details = $this->addDefaultLabel($column); |
77 | 77 | |
78 | 78 | // make sure the column has a name |
79 | - if (! array_key_exists('name', $column_with_details)) { |
|
79 | + if (!array_key_exists('name', $column_with_details)) { |
|
80 | 80 | $column_with_details['name'] = 'anonymous_column_'.str_random(5); |
81 | 81 | } |
82 | 82 | |
@@ -84,27 +84,27 @@ discard block |
||
84 | 84 | $columnExistsInDb = $this->hasColumn($this->model->getTable(), $column_with_details['name']); |
85 | 85 | |
86 | 86 | // make sure the column has a type |
87 | - if (! array_key_exists('type', $column_with_details)) { |
|
87 | + if (!array_key_exists('type', $column_with_details)) { |
|
88 | 88 | $column_with_details['type'] = 'text'; |
89 | 89 | } |
90 | 90 | |
91 | 91 | // make sure the column has a key |
92 | - if (! array_key_exists('key', $column_with_details)) { |
|
92 | + if (!array_key_exists('key', $column_with_details)) { |
|
93 | 93 | $column_with_details['key'] = $column_with_details['name']; |
94 | 94 | } |
95 | 95 | |
96 | 96 | // make sure the column has a tableColumn boolean |
97 | - if (! array_key_exists('tableColumn', $column_with_details)) { |
|
97 | + if (!array_key_exists('tableColumn', $column_with_details)) { |
|
98 | 98 | $column_with_details['tableColumn'] = $columnExistsInDb ? true : false; |
99 | 99 | } |
100 | 100 | |
101 | 101 | // make sure the column has a orderable boolean |
102 | - if (! array_key_exists('orderable', $column_with_details)) { |
|
102 | + if (!array_key_exists('orderable', $column_with_details)) { |
|
103 | 103 | $column_with_details['orderable'] = $columnExistsInDb ? true : false; |
104 | 104 | } |
105 | 105 | |
106 | 106 | // make sure the column has a searchLogic |
107 | - if (! array_key_exists('searchLogic', $column_with_details)) { |
|
107 | + if (!array_key_exists('searchLogic', $column_with_details)) { |
|
108 | 108 | $column_with_details['searchLogic'] = $columnExistsInDb ? true : false; |
109 | 109 | } |
110 | 110 | |
@@ -112,14 +112,14 @@ discard block |
||
112 | 112 | |
113 | 113 | // make sure the column has a priority in terms of visibility |
114 | 114 | // if no priority has been defined, use the order in the array plus one |
115 | - if (! array_key_exists('priority', $column_with_details)) { |
|
115 | + if (!array_key_exists('priority', $column_with_details)) { |
|
116 | 116 | $position_in_columns_array = (int) array_search($column_with_details['key'], array_keys($this->columns)); |
117 | 117 | $this->columns[$column_with_details['key']]['priority'] = $position_in_columns_array + 1; |
118 | 118 | } |
119 | 119 | |
120 | 120 | // if this is a relation type field and no corresponding model was specified, get it from the relation method |
121 | 121 | // defined in the main model |
122 | - if (isset($column_with_details['entity']) && ! isset($column_with_details['model'])) { |
|
122 | + if (isset($column_with_details['entity']) && !isset($column_with_details['model'])) { |
|
123 | 123 | $column_with_details['model'] = $this->getRelationModel($column_with_details['entity']); |
124 | 124 | } |
125 | 125 | |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | */ |
167 | 167 | public function makeFirstColumn() |
168 | 168 | { |
169 | - if (! $this->columns) { |
|
169 | + if (!$this->columns) { |
|
170 | 170 | return false; |
171 | 171 | } |
172 | 172 | |
@@ -187,8 +187,7 @@ discard block |
||
187 | 187 | $targetColumnName = is_array($targetColumn) ? $targetColumn['name'] : $targetColumn; |
188 | 188 | |
189 | 189 | if (array_key_exists($targetColumnName, $this->columns)) { |
190 | - $targetColumnPosition = $before ? array_search($targetColumnName, array_keys($this->columns)) : |
|
191 | - array_search($targetColumnName, array_keys($this->columns)) + 1; |
|
190 | + $targetColumnPosition = $before ? array_search($targetColumnName, array_keys($this->columns)) : array_search($targetColumnName, array_keys($this->columns)) + 1; |
|
192 | 191 | |
193 | 192 | $element = array_pop($this->columns); |
194 | 193 | $beginningPart = array_slice($this->columns, 0, $targetColumnPosition, true); |
@@ -225,7 +224,7 @@ discard block |
||
225 | 224 | */ |
226 | 225 | public function addDefaultLabel($array) |
227 | 226 | { |
228 | - if (! array_key_exists('label', (array) $array) && array_key_exists('name', (array) $array)) { |
|
227 | + if (!array_key_exists('label', (array) $array) && array_key_exists('name', (array) $array)) { |
|
229 | 228 | $array = array_merge(['label' => mb_ucfirst($this->makeLabel($array['name']))], $array); |
230 | 229 | |
231 | 230 | return $array; |
@@ -251,7 +250,7 @@ discard block |
||
251 | 250 | */ |
252 | 251 | public function removeColumns($columns) |
253 | 252 | { |
254 | - if (! empty($columns)) { |
|
253 | + if (!empty($columns)) { |
|
255 | 254 | foreach ($columns as $columnName) { |
256 | 255 | $this->removeColumn($columnName); |
257 | 256 | } |
@@ -273,8 +272,8 @@ discard block |
||
273 | 272 | */ |
274 | 273 | public function remove($entity, $fields) |
275 | 274 | { |
276 | - return array_values(array_filter($this->{$entity}, function ($field) use ($fields) { |
|
277 | - return ! in_array($field['name'], (array) $fields); |
|
275 | + return array_values(array_filter($this->{$entity}, function($field) use ($fields) { |
|
276 | + return !in_array($field['name'], (array) $fields); |
|
278 | 277 | })); |
279 | 278 | } |
280 | 279 | |
@@ -331,7 +330,7 @@ discard block |
||
331 | 330 | { |
332 | 331 | $columns = $this->getColumns(); |
333 | 332 | |
334 | - return collect($columns)->pluck('entity')->reject(function ($value, $key) { |
|
333 | + return collect($columns)->pluck('entity')->reject(function($value, $key) { |
|
335 | 334 | return $value == null; |
336 | 335 | })->toArray(); |
337 | 336 | } |
@@ -2,8 +2,8 @@ |
||
2 | 2 | |
3 | 3 | namespace Backpack\CRUD\Tests\Unit\CrudPanel; |
4 | 4 | |
5 | -use Illuminate\Support\Facades\DB; |
|
6 | 5 | use Backpack\CRUD\Tests\Unit\Models\Article; |
6 | +use Illuminate\Support\Facades\DB; |
|
7 | 7 | |
8 | 8 | class CrudPanelTabsTest extends BaseDBCrudPanelTest |
9 | 9 | { |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public function tabsDisabled() |
37 | 37 | { |
38 | - return ! $this->tabsEnabled; |
|
38 | + return !$this->tabsEnabled; |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | public function setTabsType($type) |
@@ -116,8 +116,8 @@ discard block |
||
116 | 116 | { |
117 | 117 | $all_fields = $this->getCurrentFields(); |
118 | 118 | |
119 | - $fields_without_a_tab = collect($all_fields)->filter(function ($value, $key) { |
|
120 | - return ! isset($value['tab']); |
|
119 | + $fields_without_a_tab = collect($all_fields)->filter(function($value, $key) { |
|
120 | + return !isset($value['tab']); |
|
121 | 121 | }); |
122 | 122 | |
123 | 123 | return $fields_without_a_tab; |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | if ($this->tabExists($label)) { |
134 | 134 | $all_fields = $this->getCurrentFields(); |
135 | 135 | |
136 | - $fields_for_current_tab = collect($all_fields)->filter(function ($value, $key) use ($label) { |
|
136 | + $fields_for_current_tab = collect($all_fields)->filter(function($value, $key) use ($label) { |
|
137 | 137 | return isset($value['tab']) && $value['tab'] == $label; |
138 | 138 | }); |
139 | 139 | |
@@ -152,11 +152,11 @@ discard block |
||
152 | 152 | $fields = $this->getCurrentFields(); |
153 | 153 | |
154 | 154 | $fields_with_tabs = collect($fields) |
155 | - ->filter(function ($value, $key) { |
|
155 | + ->filter(function($value, $key) { |
|
156 | 156 | return isset($value['tab']); |
157 | 157 | }) |
158 | - ->each(function ($value, $key) use (&$tabs) { |
|
159 | - if (! in_array($value['tab'], $tabs)) { |
|
158 | + ->each(function($value, $key) use (&$tabs) { |
|
159 | + if (!in_array($value['tab'], $tabs)) { |
|
160 | 160 | $tabs[] = $value['tab']; |
161 | 161 | } |
162 | 162 | }); |
@@ -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 | { |
@@ -2,7 +2,7 @@ |
||
2 | 2 | <div @include('crud::inc.field_wrapper_attributes') > |
3 | 3 | <label>{!! $field['label'] !!}</label> |
4 | 4 | @include('crud::inc.field_translatable_icon') |
5 | - <?php $entity_model = $crud->getRelationModel($field['entity'], - 1); ?> |
|
5 | + <?php $entity_model = $crud->getRelationModel($field['entity'], - 1); ?> |
|
6 | 6 | <select |
7 | 7 | name="{{ $field['name'] }}" |
8 | 8 | style="width: 100%" |