@@ -125,13 +125,13 @@ discard block |
||
125 | 125 | } |
126 | 126 | |
127 | 127 | $customDisplayedColumns = $this->getConfigValue($action, 'display'); |
128 | - $customHiddenColumns = $this->getConfigValue($action, 'hide') ? : []; |
|
128 | + $customHiddenColumns = $this->getConfigValue($action, 'hide') ?: []; |
|
129 | 129 | |
130 | 130 | $columns = array(); |
131 | - if (! empty($customDisplayedColumns) && is_array($customDisplayedColumns)) { |
|
131 | + if (!empty($customDisplayedColumns) && is_array($customDisplayedColumns)) { |
|
132 | 132 | foreach ($customDisplayedColumns as $customColumn) { |
133 | - if (! array_key_exists($customColumn, $tableColumns)) { |
|
134 | - throw new AbstractorException("Column " . $customColumn . " does not exist on " . $this->getModel()); |
|
133 | + if (!array_key_exists($customColumn, $tableColumns)) { |
|
134 | + throw new AbstractorException("Column ".$customColumn." does not exist on ".$this->getModel()); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | $columns[$customColumn] = $tableColumns[$customColumn]; |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | |
163 | 163 | $relations = collect(); |
164 | 164 | |
165 | - if (! empty($configRelations)) { |
|
165 | + if (!empty($configRelations)) { |
|
166 | 166 | foreach ($configRelations as $relationName => $configRelation) { |
167 | 167 | if (is_int($relationName)) { |
168 | 168 | $relationName = $configRelation; |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | |
171 | 171 | $config = []; |
172 | 172 | if ($configRelation !== $relationName) { |
173 | - if (! is_array($configRelation)) { |
|
173 | + if (!is_array($configRelation)) { |
|
174 | 174 | $config['type'] = $configRelation; |
175 | 175 | } else { |
176 | 176 | $config = $configRelation; |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | $secondaryRelations = $relation->getSecondaryRelations(); |
186 | 186 | |
187 | 187 | |
188 | - if (! $secondaryRelations->isEmpty()) { |
|
188 | + if (!$secondaryRelations->isEmpty()) { |
|
189 | 189 | $relations->put($relationName, |
190 | 190 | collect(['relation' => $relation, 'secondaryRelations' => $secondaryRelations])); |
191 | 191 | } else { |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | { |
208 | 208 | $columns = $this->getColumns('list'); |
209 | 209 | |
210 | - $fieldsPresentation = $this->getConfigValue('fields_presentation') ? : []; |
|
210 | + $fieldsPresentation = $this->getConfigValue('fields_presentation') ?: []; |
|
211 | 211 | |
212 | 212 | $fields = array(); |
213 | 213 | foreach ($columns as $name => $column) { |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | { |
243 | 243 | $columns = $this->getColumns('detail'); |
244 | 244 | |
245 | - $fieldsPresentation = $this->getConfigValue('fields_presentation') ? : []; |
|
245 | + $fieldsPresentation = $this->getConfigValue('fields_presentation') ?: []; |
|
246 | 246 | |
247 | 247 | $fields = array(); |
248 | 248 | foreach ($columns as $name => $column) { |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | |
283 | 283 | $fields = array(); |
284 | 284 | foreach ($columns as $name => $column) { |
285 | - if (! in_array($name, $this->getReadOnlyColumns())) { |
|
285 | + if (!in_array($name, $this->getReadOnlyColumns())) { |
|
286 | 286 | $presentation = null; |
287 | 287 | if (array_key_exists($name, $this->fieldsPresentation)) { |
288 | 288 | $presentation = $this->fieldsPresentation[$name]; |
@@ -303,17 +303,17 @@ discard block |
||
303 | 303 | ->setConfig($config) |
304 | 304 | ->get(); |
305 | 305 | |
306 | - if (! empty($this->instance) && ! empty($this->instance->getAttribute($name))) { |
|
306 | + if (!empty($this->instance) && !empty($this->instance->getAttribute($name))) { |
|
307 | 307 | $field->setValue($this->instance->getAttribute($name)); |
308 | 308 | } |
309 | 309 | |
310 | 310 | $fields[$arrayKey][] = $field; |
311 | 311 | |
312 | - if (! empty($config['form_type']) && $config['form_type'] === 'file') { |
|
312 | + if (!empty($config['form_type']) && $config['form_type'] === 'file') { |
|
313 | 313 | $field = $this->fieldFactory |
314 | 314 | ->setColumn($column) |
315 | 315 | ->setConfig([ |
316 | - 'name' => $name . '__delete', |
|
316 | + 'name' => $name.'__delete', |
|
317 | 317 | 'presentation' => null, |
318 | 318 | 'form_type' => 'checkbox', |
319 | 319 | 'validation' => null, |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | { |
358 | 358 | /** @var \ANavallaSuiza\Laravel\Database\Contracts\Manager\ModelManager $modelManager */ |
359 | 359 | $modelManager = App::make('ANavallaSuiza\Laravel\Database\Contracts\Manager\ModelManager'); |
360 | - if (! empty($this->instance)) { |
|
360 | + if (!empty($this->instance)) { |
|
361 | 361 | $item = $this->instance; |
362 | 362 | } else { |
363 | 363 | $item = $modelManager->getModelInstance($this->getModel()); |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | return; |
370 | 370 | } |
371 | 371 | |
372 | - if (! empty($fields['main'])) { |
|
372 | + if (!empty($fields['main'])) { |
|
373 | 373 | $skipNext = false; |
374 | 374 | foreach ($fields['main'] as $key => $field) { |
375 | 375 | if ($skipNext === true) { |
@@ -379,15 +379,15 @@ discard block |
||
379 | 379 | $requestValue = $request->input("main.{$fieldName}"); |
380 | 380 | |
381 | 381 | if (get_class($field->getFormField()) === \FormManager\Fields\File::class) { |
382 | - $modelFolder = $this->slug . DIRECTORY_SEPARATOR; |
|
382 | + $modelFolder = $this->slug.DIRECTORY_SEPARATOR; |
|
383 | 383 | $basePath = base_path(config('anavel-crud.uploads_path')); |
384 | - $modelPath = $basePath . $modelFolder; |
|
385 | - if (! empty($fields['main'][$key + 1]) && $fields['main'][$key + 1]->getName() === $fieldName . '__delete') { |
|
384 | + $modelPath = $basePath.$modelFolder; |
|
385 | + if (!empty($fields['main'][$key + 1]) && $fields['main'][$key + 1]->getName() === $fieldName.'__delete') { |
|
386 | 386 | //We never want to save this field, it doesn't exist in the DB |
387 | 387 | $skipNext = true; |
388 | 388 | |
389 | 389 | //If user wants to delete the existing file |
390 | - if (! empty($request->input("main.{$fieldName}__delete"))) { |
|
390 | + if (!empty($request->input("main.{$fieldName}__delete"))) { |
|
391 | 391 | $adapter = new Local($basePath); |
392 | 392 | $filesystem = new Filesystem($adapter); |
393 | 393 | if ($filesystem->has($item->$fieldName)) { |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | } |
404 | 404 | } |
405 | 405 | if ($request->hasFile('main.'.$fieldName)) { |
406 | - $fileName = uniqid() . '.' . $request->file('main.'.$fieldName)->getClientOriginalExtension(); |
|
406 | + $fileName = uniqid().'.'.$request->file('main.'.$fieldName)->getClientOriginalExtension(); |
|
407 | 407 | |
408 | 408 | |
409 | 409 | $request->file('main.'.$fieldName)->move( |
@@ -411,18 +411,18 @@ discard block |
||
411 | 411 | $fileName |
412 | 412 | ); |
413 | 413 | |
414 | - $requestValue = $modelFolder . $fileName; |
|
415 | - } elseif (! $request->file('main.'.$fieldName)->isValid()) { |
|
414 | + $requestValue = $modelFolder.$fileName; |
|
415 | + } elseif (!$request->file('main.'.$fieldName)->isValid()) { |
|
416 | 416 | throw new \Exception($request->file('main.'.$fieldName)->getErrorMessage()); |
417 | 417 | } |
418 | 418 | |
419 | 419 | } |
420 | 420 | |
421 | - if (! $field->saveIfEmpty() && empty($requestValue)) { |
|
421 | + if (!$field->saveIfEmpty() && empty($requestValue)) { |
|
422 | 422 | continue; |
423 | 423 | } |
424 | 424 | |
425 | - if (! empty($requestValue)) { |
|
425 | + if (!empty($requestValue)) { |
|
426 | 426 | $item->setAttribute( |
427 | 427 | $fieldName, |
428 | 428 | $field->applyFunctions($requestValue) |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | $this->setInstance($item); |
437 | 437 | |
438 | 438 | |
439 | - if (! empty($relations = $this->getRelations())) { |
|
439 | + if (!empty($relations = $this->getRelations())) { |
|
440 | 440 | foreach ($relations as $relationKey => $relation) { |
441 | 441 | if ($relation instanceof Collection) { |
442 | 442 | $input = $request->input($relationKey); |