We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -12,7 +12,7 @@ |
||
12 | 12 | */ |
13 | 13 | public function up() |
14 | 14 | { |
15 | - Schema::create('articles', function ($table) { |
|
15 | + Schema::create('articles', function($table) { |
|
16 | 16 | $table->increments('id'); |
17 | 17 | $table->integer('user_id')->length(10)->unsigned(); |
18 | 18 | $table->string('content'); |
@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | public function up() |
15 | 15 | { |
16 | - Schema::create('account_details', function (Blueprint $table) { |
|
16 | + Schema::create('account_details', function(Blueprint $table) { |
|
17 | 17 | $table->increments('id'); |
18 | 18 | $table->integer('user_id')->length(10)->unsigned(); |
19 | 19 | $table->string('nickname'); |
@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | public function up() |
15 | 15 | { |
16 | - Schema::create('users', function (Blueprint $table) { |
|
16 | + Schema::create('users', function(Blueprint $table) { |
|
17 | 17 | $table->increments('id'); |
18 | 18 | $table->string('name'); |
19 | 19 | $table->string('email')->unique(); |
@@ -15,7 +15,7 @@ |
||
15 | 15 | // uncomment the next statement to map strings to enum types in doctrine and get over the 'Unknown database type enum' DBAL error |
16 | 16 | // Schema::getConnection()->getDoctrineSchemaManager()->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string'); |
17 | 17 | |
18 | - Schema::create('column_types', function ($table) { |
|
18 | + Schema::create('column_types', function($table) { |
|
19 | 19 | $table->bigInteger('bigIntegerCol'); |
20 | 20 | $table->binary('binaryCol'); |
21 | 21 | $table->boolean('booleanCol'); |
@@ -217,7 +217,7 @@ |
||
217 | 217 | |
218 | 218 | private function getButtonByName($name) |
219 | 219 | { |
220 | - return $this->crudPanel->buttons->first(function ($value) use ($name) { |
|
220 | + return $this->crudPanel->buttons->first(function($value) use ($name) { |
|
221 | 221 | return $value->name == $name; |
222 | 222 | }); |
223 | 223 | } |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | /** |
95 | 95 | * Move the most recently added column after the given target column. |
96 | 96 | * |
97 | - * @param string|array $targetColumn The target column name or array. |
|
97 | + * @param string $targetColumn The target column name or array. |
|
98 | 98 | */ |
99 | 99 | public function afterColumn($targetColumn) |
100 | 100 | { |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | /** |
105 | 105 | * Move the most recently added column before the given target column. |
106 | 106 | * |
107 | - * @param string|array $targetColumn The target column name or array. |
|
107 | + * @param string $targetColumn The target column name or array. |
|
108 | 108 | */ |
109 | 109 | public function beforeColumn($targetColumn) |
110 | 110 | { |
@@ -227,6 +227,7 @@ discard block |
||
227 | 227 | * |
228 | 228 | * @param [string] Column name. |
229 | 229 | * @param [attributes and values array] |
230 | + * @param string $column |
|
230 | 231 | */ |
231 | 232 | public function setColumnDetails($column, $attributes) |
232 | 233 | { |
@@ -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 | |
@@ -162,8 +162,7 @@ discard block |
||
162 | 162 | $targetColumnName = is_array($targetColumn) ? $targetColumn['name'] : $targetColumn; |
163 | 163 | |
164 | 164 | if (array_key_exists($targetColumnName, $this->columns)) { |
165 | - $targetColumnPosition = $before ? array_search($targetColumnName, array_keys($this->columns)) : |
|
166 | - array_search($targetColumnName, array_keys($this->columns)) + 1; |
|
165 | + $targetColumnPosition = $before ? array_search($targetColumnName, array_keys($this->columns)) : array_search($targetColumnName, array_keys($this->columns)) + 1; |
|
167 | 166 | |
168 | 167 | $element = array_pop($this->columns); |
169 | 168 | $beginningPart = array_slice($this->columns, 0, $targetColumnPosition, true); |
@@ -197,7 +196,7 @@ discard block |
||
197 | 196 | */ |
198 | 197 | public function addDefaultLabel($array) |
199 | 198 | { |
200 | - if (! array_key_exists('label', (array) $array) && array_key_exists('name', (array) $array)) { |
|
199 | + if (!array_key_exists('label', (array) $array) && array_key_exists('name', (array) $array)) { |
|
201 | 200 | $array = array_merge(['label' => ucfirst($this->makeLabel($array['name']))], $array); |
202 | 201 | |
203 | 202 | return $array; |
@@ -223,7 +222,7 @@ discard block |
||
223 | 222 | */ |
224 | 223 | public function removeColumns($columns) |
225 | 224 | { |
226 | - if (! empty($columns)) { |
|
225 | + if (!empty($columns)) { |
|
227 | 226 | foreach ($columns as $columnName) { |
228 | 227 | $this->removeColumn($columnName); |
229 | 228 | } |
@@ -244,8 +243,8 @@ discard block |
||
244 | 243 | */ |
245 | 244 | public function remove($entity, $fields) |
246 | 245 | { |
247 | - return array_values(array_filter($this->{$entity}, function ($field) use ($fields) { |
|
248 | - return ! in_array($field['name'], (array) $fields); |
|
246 | + return array_values(array_filter($this->{$entity}, function($field) use ($fields) { |
|
247 | + return !in_array($field['name'], (array) $fields); |
|
249 | 248 | })); |
250 | 249 | } |
251 | 250 | |
@@ -290,7 +289,7 @@ discard block |
||
290 | 289 | { |
291 | 290 | $columns = $this->getColumns(); |
292 | 291 | |
293 | - return collect($columns)->pluck('entity')->reject(function ($value, $key) { |
|
292 | + return collect($columns)->pluck('entity')->reject(function($value, $key) { |
|
294 | 293 | return $value == null; |
295 | 294 | })->toArray(); |
296 | 295 | } |
@@ -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 | } |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | $jsonCastables = ['array', 'object', 'json']; |
213 | 213 | $fieldCasting = $casted_attributes[$field['name']]; |
214 | 214 | |
215 | - if (in_array($fieldCasting, $jsonCastables) && isset($data[$field['name']]) && ! empty($data[$field['name']]) && ! is_array($data[$field['name']])) { |
|
215 | + if (in_array($fieldCasting, $jsonCastables) && isset($data[$field['name']]) && !empty($data[$field['name']]) && !is_array($data[$field['name']])) { |
|
216 | 216 | try { |
217 | 217 | $data[$field['name']] = json_decode($data[$field['name']]); |
218 | 218 | } catch (\Exception $e) { |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | */ |
244 | 244 | public function orderFields($order, $form = 'both') |
245 | 245 | { |
246 | - $this->transformFields($form, function ($fields) use ($order) { |
|
246 | + $this->transformFields($form, function($fields) use ($order) { |
|
247 | 247 | return $this->applyOrderToFields($fields, $order); |
248 | 248 | }); |
249 | 249 | } |
@@ -49,7 +49,7 @@ |
||
49 | 49 | */ |
50 | 50 | protected function makeSlugUnique(string $slug, array $config, string $attribute): string |
51 | 51 | { |
52 | - if (! $config['unique']) { |
|
52 | + if (!$config['unique']) { |
|
53 | 53 | return $slug; |
54 | 54 | } |
55 | 55 |
@@ -33,12 +33,12 @@ |
||
33 | 33 | |
34 | 34 | public function __construct() |
35 | 35 | { |
36 | - if (! $this->crud) { |
|
36 | + if (!$this->crud) { |
|
37 | 37 | $this->crud = app()->make(CrudPanel::class); |
38 | 38 | |
39 | 39 | // call the setup function inside this closure to also have the request there |
40 | 40 | // this way, developers can use things stored in session (auth variables, etc) |
41 | - $this->middleware(function ($request, $next) { |
|
41 | + $this->middleware(function($request, $next) { |
|
42 | 42 | $this->request = $request; |
43 | 43 | $this->crud->request = $request; |
44 | 44 | $this->setup(); |
@@ -3,18 +3,15 @@ |
||
3 | 3 | namespace Backpack\CRUD\app\Http\Controllers; |
4 | 4 | |
5 | 5 | use Backpack\CRUD\CrudPanel; |
6 | -use Illuminate\Http\Request; |
|
7 | -use Illuminate\Http\Request as StoreRequest; |
|
8 | -use Illuminate\Support\Facades\Form as Form; |
|
9 | -use Illuminate\Foundation\Bus\DispatchesJobs; |
|
10 | -use Illuminate\Http\Request as UpdateRequest; |
|
11 | -use Illuminate\Routing\Controller as BaseController; |
|
12 | -use Illuminate\Foundation\Validation\ValidatesRequests; |
|
13 | -use Backpack\CRUD\app\Http\Controllers\CrudFeatures\Reorder; |
|
14 | 6 | use Backpack\CRUD\app\Http\Controllers\CrudFeatures\AjaxTable; |
7 | +use Backpack\CRUD\app\Http\Controllers\CrudFeatures\Reorder; |
|
15 | 8 | use Backpack\CRUD\app\Http\Controllers\CrudFeatures\Revisions; |
16 | 9 | use Backpack\CRUD\app\Http\Controllers\CrudFeatures\SaveActions; |
17 | 10 | use Backpack\CRUD\app\Http\Controllers\CrudFeatures\ShowDetailsRow; |
11 | +use Illuminate\Foundation\Bus\DispatchesJobs; |
|
12 | +use Illuminate\Foundation\Validation\ValidatesRequests; |
|
13 | +use Illuminate\Http\Request as UpdateRequest; |
|
14 | +use Illuminate\Routing\Controller as BaseController; |
|
18 | 15 | |
19 | 16 | class CrudController extends BaseController |
20 | 17 | { |