We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -25,9 +25,9 @@ |
||
25 | 25 | </thead> |
26 | 26 | <?php |
27 | 27 | |
28 | -if (! empty($_POST)) { |
|
28 | +if (!empty($_POST)) { |
|
29 | 29 | foreach ($_POST as $key => $value) { |
30 | - if ((! is_string($value) && ! is_numeric($value)) || ! is_string($key)) { |
|
30 | + if ((!is_string($value) && !is_numeric($value)) || !is_string($key)) { |
|
31 | 31 | continue; |
32 | 32 | } |
33 | 33 |
@@ -26,28 +26,28 @@ discard block |
||
26 | 26 | |
27 | 27 | // if this is a relation type field and no corresponding model was specified, get it from the relation method |
28 | 28 | // defined in the main model |
29 | - if (isset($completeFieldsArray['entity']) && ! isset($completeFieldsArray['model'])) { |
|
29 | + if (isset($completeFieldsArray['entity']) && !isset($completeFieldsArray['model'])) { |
|
30 | 30 | $completeFieldsArray['model'] = $this->getRelationModel($completeFieldsArray['entity']); |
31 | 31 | } |
32 | 32 | |
33 | 33 | // if the label is missing, we should set it |
34 | - if (! isset($completeFieldsArray['label'])) { |
|
34 | + if (!isset($completeFieldsArray['label'])) { |
|
35 | 35 | $completeFieldsArray['label'] = ucfirst($completeFieldsArray['name']); |
36 | 36 | } |
37 | 37 | |
38 | 38 | // if the field type is missing, we should set it |
39 | - if (! isset($completeFieldsArray['type'])) { |
|
39 | + if (!isset($completeFieldsArray['type'])) { |
|
40 | 40 | $completeFieldsArray['type'] = $this->getFieldTypeFromDbColumnType($completeFieldsArray['name']); |
41 | 41 | } |
42 | 42 | |
43 | 43 | // if a tab was mentioned, we should enable it |
44 | 44 | if (isset($completeFieldsArray['tab'])) { |
45 | - if (! $this->tabsEnabled()) { |
|
45 | + if (!$this->tabsEnabled()) { |
|
46 | 46 | $this->enableTabs(); |
47 | 47 | } |
48 | 48 | } |
49 | 49 | |
50 | - $this->transformFields($form, function ($fields) use ($completeFieldsArray) { |
|
50 | + $this->transformFields($form, function($fields) use ($completeFieldsArray) { |
|
51 | 51 | $fields[$completeFieldsArray['name']] = $completeFieldsArray; |
52 | 52 | |
53 | 53 | return $fields; |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function afterField($targetFieldName, $form = 'both') |
81 | 81 | { |
82 | - $this->transformFields($form, function ($fields) use ($targetFieldName) { |
|
82 | + $this->transformFields($form, function($fields) use ($targetFieldName) { |
|
83 | 83 | return $this->moveField($fields, $targetFieldName, false); |
84 | 84 | }); |
85 | 85 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | */ |
93 | 93 | public function beforeField($targetFieldName, $form = 'both') |
94 | 94 | { |
95 | - $this->transformFields($form, function ($fields) use ($targetFieldName) { |
|
95 | + $this->transformFields($form, function($fields) use ($targetFieldName) { |
|
96 | 96 | return $this->moveField($fields, $targetFieldName, true); |
97 | 97 | }); |
98 | 98 | } |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | */ |
135 | 135 | public function removeField($name, $form = 'both') |
136 | 136 | { |
137 | - $this->transformFields($form, function ($fields) use ($name) { |
|
137 | + $this->transformFields($form, function($fields) use ($name) { |
|
138 | 138 | array_forget($fields, $name); |
139 | 139 | |
140 | 140 | return $fields; |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | */ |
150 | 150 | public function removeFields($array_of_names, $form = 'both') |
151 | 151 | { |
152 | - if (! empty($array_of_names)) { |
|
152 | + if (!empty($array_of_names)) { |
|
153 | 153 | foreach ($array_of_names as $name) { |
154 | 154 | $this->removeField($name, $form); |
155 | 155 | } |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | public function removeAllFields($form = 'both') |
165 | 165 | { |
166 | 166 | $current_fields = $this->getCurrentFields(); |
167 | - if (! empty($current_fields)) { |
|
167 | + if (!empty($current_fields)) { |
|
168 | 168 | foreach ($current_fields as $field) { |
169 | 169 | $this->removeField($field['name'], $form); |
170 | 170 | } |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | $jsonCastables = ['array', 'object', 'json']; |
228 | 228 | $fieldCasting = $casted_attributes[$field['name']]; |
229 | 229 | |
230 | - if (in_array($fieldCasting, $jsonCastables) && isset($data[$field['name']]) && ! empty($data[$field['name']]) && ! is_array($data[$field['name']])) { |
|
230 | + if (in_array($fieldCasting, $jsonCastables) && isset($data[$field['name']]) && !empty($data[$field['name']]) && !is_array($data[$field['name']])) { |
|
231 | 231 | try { |
232 | 232 | $data[$field['name']] = json_decode($data[$field['name']]); |
233 | 233 | } catch (\Exception $e) { |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | */ |
259 | 259 | public function orderFields($order, $form = 'both') |
260 | 260 | { |
261 | - $this->transformFields($form, function ($fields) use ($order) { |
|
261 | + $this->transformFields($form, function($fields) use ($order) { |
|
262 | 262 | return $this->applyOrderToFields($fields, $order); |
263 | 263 | }); |
264 | 264 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | $sourceFile = $this->sourcePath.$file.'.blade.php'; |
74 | 74 | $copiedFile = $this->destinationPath.$file.'.blade.php'; |
75 | 75 | |
76 | - if (! file_exists($sourceFile)) { |
|
76 | + if (!file_exists($sourceFile)) { |
|
77 | 77 | return $this->error( |
78 | 78 | 'Cannot find source view file at ' |
79 | 79 | .$sourceFile. |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | if ($canCopy) { |
94 | 94 | $path = pathinfo($copiedFile); |
95 | 95 | |
96 | - if (! file_exists($path['dirname'])) { |
|
96 | + if (!file_exists($path['dirname'])) { |
|
97 | 97 | mkdir($path['dirname'], 0755, true); |
98 | 98 | } |
99 | 99 |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | /** |
133 | 133 | * Move the most recently added column after the given target column. |
134 | 134 | * |
135 | - * @param string|array $targetColumn The target column name or array. |
|
135 | + * @param string $targetColumn The target column name or array. |
|
136 | 136 | */ |
137 | 137 | public function afterColumn($targetColumn) |
138 | 138 | { |
@@ -278,6 +278,7 @@ discard block |
||
278 | 278 | * |
279 | 279 | * @param [string] Column name. |
280 | 280 | * @param [attributes and values array] |
281 | + * @param string $column |
|
281 | 282 | */ |
282 | 283 | public function setColumnDetails($column, $attributes) |
283 | 284 | { |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | public function addColumn($column) |
65 | 65 | { |
66 | 66 | // if a string was passed, not an array, change it to an array |
67 | - if (! is_array($column)) { |
|
67 | + if (!is_array($column)) { |
|
68 | 68 | $column = ['name' => $column]; |
69 | 69 | } |
70 | 70 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | $column_with_details = $this->addDefaultLabel($column); |
73 | 73 | |
74 | 74 | // make sure the column has a name |
75 | - if (! array_key_exists('name', $column_with_details)) { |
|
75 | + if (!array_key_exists('name', $column_with_details)) { |
|
76 | 76 | $column_with_details['name'] = 'anonymous_column_'.str_random(5); |
77 | 77 | } |
78 | 78 | |
@@ -80,27 +80,27 @@ discard block |
||
80 | 80 | $columnExistsInDb = $this->hasColumn($this->model->getTable(), $column_with_details['name']); |
81 | 81 | |
82 | 82 | // make sure the column has a type |
83 | - if (! array_key_exists('type', $column_with_details)) { |
|
83 | + if (!array_key_exists('type', $column_with_details)) { |
|
84 | 84 | $column_with_details['type'] = 'text'; |
85 | 85 | } |
86 | 86 | |
87 | 87 | // make sure the column has a key |
88 | - if (! array_key_exists('key', $column_with_details)) { |
|
88 | + if (!array_key_exists('key', $column_with_details)) { |
|
89 | 89 | $column_with_details['key'] = $column_with_details['name']; |
90 | 90 | } |
91 | 91 | |
92 | 92 | // make sure the column has a tableColumn boolean |
93 | - if (! array_key_exists('tableColumn', $column_with_details)) { |
|
93 | + if (!array_key_exists('tableColumn', $column_with_details)) { |
|
94 | 94 | $column_with_details['tableColumn'] = $columnExistsInDb ? true : false; |
95 | 95 | } |
96 | 96 | |
97 | 97 | // make sure the column has a orderable boolean |
98 | - if (! array_key_exists('orderable', $column_with_details)) { |
|
98 | + if (!array_key_exists('orderable', $column_with_details)) { |
|
99 | 99 | $column_with_details['orderable'] = $columnExistsInDb ? true : false; |
100 | 100 | } |
101 | 101 | |
102 | 102 | // make sure the column has a searchLogic |
103 | - if (! array_key_exists('searchLogic', $column_with_details)) { |
|
103 | + if (!array_key_exists('searchLogic', $column_with_details)) { |
|
104 | 104 | $column_with_details['searchLogic'] = $columnExistsInDb ? true : false; |
105 | 105 | } |
106 | 106 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | |
109 | 109 | // if this is a relation type field and no corresponding model was specified, get it from the relation method |
110 | 110 | // defined in the main model |
111 | - if (isset($column_with_details['entity']) && ! isset($column_with_details['model'])) { |
|
111 | + if (isset($column_with_details['entity']) && !isset($column_with_details['model'])) { |
|
112 | 112 | $column_with_details['model'] = $this->getRelationModel($column_with_details['entity']); |
113 | 113 | } |
114 | 114 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | */ |
155 | 155 | public function makeFirstColumn() |
156 | 156 | { |
157 | - if (! $this->columns) { |
|
157 | + if (!$this->columns) { |
|
158 | 158 | return false; |
159 | 159 | } |
160 | 160 | |
@@ -175,8 +175,7 @@ discard block |
||
175 | 175 | $targetColumnName = is_array($targetColumn) ? $targetColumn['name'] : $targetColumn; |
176 | 176 | |
177 | 177 | if (array_key_exists($targetColumnName, $this->columns)) { |
178 | - $targetColumnPosition = $before ? array_search($targetColumnName, array_keys($this->columns)) : |
|
179 | - array_search($targetColumnName, array_keys($this->columns)) + 1; |
|
178 | + $targetColumnPosition = $before ? array_search($targetColumnName, array_keys($this->columns)) : array_search($targetColumnName, array_keys($this->columns)) + 1; |
|
180 | 179 | |
181 | 180 | $element = array_pop($this->columns); |
182 | 181 | $beginningPart = array_slice($this->columns, 0, $targetColumnPosition, true); |
@@ -210,7 +209,7 @@ discard block |
||
210 | 209 | */ |
211 | 210 | public function addDefaultLabel($array) |
212 | 211 | { |
213 | - if (! array_key_exists('label', (array) $array) && array_key_exists('name', (array) $array)) { |
|
212 | + if (!array_key_exists('label', (array) $array) && array_key_exists('name', (array) $array)) { |
|
214 | 213 | $array = array_merge(['label' => ucfirst($this->makeLabel($array['name']))], $array); |
215 | 214 | |
216 | 215 | return $array; |
@@ -236,7 +235,7 @@ discard block |
||
236 | 235 | */ |
237 | 236 | public function removeColumns($columns) |
238 | 237 | { |
239 | - if (! empty($columns)) { |
|
238 | + if (!empty($columns)) { |
|
240 | 239 | foreach ($columns as $columnName) { |
241 | 240 | $this->removeColumn($columnName); |
242 | 241 | } |
@@ -257,8 +256,8 @@ discard block |
||
257 | 256 | */ |
258 | 257 | public function remove($entity, $fields) |
259 | 258 | { |
260 | - return array_values(array_filter($this->{$entity}, function ($field) use ($fields) { |
|
261 | - return ! in_array($field['name'], (array) $fields); |
|
259 | + return array_values(array_filter($this->{$entity}, function($field) use ($fields) { |
|
260 | + return !in_array($field['name'], (array) $fields); |
|
262 | 261 | })); |
263 | 262 | } |
264 | 263 | |
@@ -303,7 +302,7 @@ discard block |
||
303 | 302 | { |
304 | 303 | $columns = $this->getColumns(); |
305 | 304 | |
306 | - return collect($columns)->pluck('entity')->reject(function ($value, $key) { |
|
305 | + return collect($columns)->pluck('entity')->reject(function($value, $key) { |
|
307 | 306 | return $value == null; |
308 | 307 | })->toArray(); |
309 | 308 | } |
@@ -119,10 +119,10 @@ |
||
119 | 119 | // add the details_row button to the first column |
120 | 120 | if ($this->details_row) { |
121 | 121 | $details_row_button = \View::make('crud::columns.details_row_button') |
122 | - ->with('crud', $this) |
|
123 | - ->with('entry', $entry) |
|
124 | - ->with('row_number', $rowNumber) |
|
125 | - ->render(); |
|
122 | + ->with('crud', $this) |
|
123 | + ->with('entry', $entry) |
|
124 | + ->with('row_number', $rowNumber) |
|
125 | + ->render(); |
|
126 | 126 | $row_items[0] = $details_row_button.$row_items[0]; |
127 | 127 | } |
128 | 128 |
@@ -169,7 +169,7 @@ |
||
169 | 169 | |
170 | 170 | /** |
171 | 171 | * Render the given view. |
172 | - * @param $view |
|
172 | + * @param string $view |
|
173 | 173 | * @param $column |
174 | 174 | * @param $entry |
175 | 175 | * @param int The number shown to the user as row number (index); |
@@ -19,9 +19,9 @@ discard block |
||
19 | 19 | */ |
20 | 20 | public function applySearchTerm($searchTerm) |
21 | 21 | { |
22 | - return $this->query->where(function ($query) use ($searchTerm) { |
|
22 | + return $this->query->where(function($query) use ($searchTerm) { |
|
23 | 23 | foreach ($this->getColumns() as $column) { |
24 | - if (! isset($column['type'])) { |
|
24 | + if (!isset($column['type'])) { |
|
25 | 25 | abort(400, 'Missing column type when trying to apply search term.'); |
26 | 26 | } |
27 | 27 | |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | case 'select': |
62 | 62 | case 'select_multiple': |
63 | - $query->orWhereHas($column['entity'], function ($q) use ($column, $searchTerm) { |
|
63 | + $query->orWhereHas($column['entity'], function($q) use ($column, $searchTerm) { |
|
64 | 64 | $q->where($column['attribute'], 'like', '%'.$searchTerm.'%'); |
65 | 65 | }); |
66 | 66 | break; |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | */ |
178 | 178 | private function renderCellView($view, $column, $entry, $rowNumber = false) |
179 | 179 | { |
180 | - if (! view()->exists($view)) { |
|
180 | + if (!view()->exists($view)) { |
|
181 | 181 | $view = 'crud::columns.text'; // fallback to text column |
182 | 182 | } |
183 | 183 |