Completed
Push — master ( 0d683b...737f06 )
by
unknown
05:53
created
src/Abstractor/Eloquent/Model.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -128,13 +128,13 @@  discard block
 block discarded – undo
128 128
         }
129 129
 
130 130
         $customDisplayedColumns = $this->getConfigValue($action, 'display');
131
-        $customHiddenColumns = $this->getConfigValue($action, 'hide') ? : [];
131
+        $customHiddenColumns = $this->getConfigValue($action, 'hide') ?: [];
132 132
 
133 133
         $columns = array();
134
-        if (! empty($customDisplayedColumns) && is_array($customDisplayedColumns)) {
134
+        if (!empty($customDisplayedColumns) && is_array($customDisplayedColumns)) {
135 135
             foreach ($customDisplayedColumns as $customColumn) {
136
-                if (! array_key_exists($customColumn, $tableColumns)) {
137
-                    throw new AbstractorException("Column " . $customColumn . " does not exist on " . $this->getModel());
136
+                if (!array_key_exists($customColumn, $tableColumns)) {
137
+                    throw new AbstractorException("Column ".$customColumn." does not exist on ".$this->getModel());
138 138
                 }
139 139
 
140 140
                 $columns[$customColumn] = $tableColumns[$customColumn];
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 
166 166
         $relations = collect();
167 167
 
168
-        if (! empty($configRelations)) {
168
+        if (!empty($configRelations)) {
169 169
             foreach ($configRelations as $relationName => $configRelation) {
170 170
                 if (is_int($relationName)) {
171 171
                     $relationName = $configRelation;
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 
174 174
                 $config = [];
175 175
                 if ($configRelation !== $relationName) {
176
-                    if (! is_array($configRelation)) {
176
+                    if (!is_array($configRelation)) {
177 177
                         $config['type'] = $configRelation;
178 178
                     } else {
179 179
                         $config = $configRelation;
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
                 $secondaryRelations = $relation->getSecondaryRelations();
189 189
 
190 190
 
191
-                if (! $secondaryRelations->isEmpty()) {
191
+                if (!$secondaryRelations->isEmpty()) {
192 192
                     $relations->put($relationName,
193 193
                         collect(['relation' => $relation, 'secondaryRelations' => $secondaryRelations]));
194 194
                 } else {
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
     {
211 211
         $columns = $this->getColumns('list');
212 212
 
213
-        $fieldsPresentation = $this->getConfigValue('fields_presentation') ? : [];
213
+        $fieldsPresentation = $this->getConfigValue('fields_presentation') ?: [];
214 214
 
215 215
         $fields = array();
216 216
         foreach ($columns as $name => $column) {
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
     {
246 246
         $columns = $this->getColumns('detail');
247 247
 
248
-        $fieldsPresentation = $this->getConfigValue('fields_presentation') ? : [];
248
+        $fieldsPresentation = $this->getConfigValue('fields_presentation') ?: [];
249 249
 
250 250
         $fields = array();
251 251
         foreach ($columns as $name => $column) {
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 
286 286
         $fields = array();
287 287
         foreach ($columns as $name => $column) {
288
-            if (! in_array($name, $this->getReadOnlyColumns())) {
288
+            if (!in_array($name, $this->getReadOnlyColumns())) {
289 289
                 $presentation = null;
290 290
                 if (array_key_exists($name, $this->fieldsPresentation)) {
291 291
                     $presentation = $this->fieldsPresentation[$name];
@@ -306,24 +306,24 @@  discard block
 block discarded – undo
306 306
                     ->setConfig($config)
307 307
                     ->get();
308 308
 
309
-                if (! empty($this->instance) && ! empty($this->instance->getAttribute($name))) {
309
+                if (!empty($this->instance) && !empty($this->instance->getAttribute($name))) {
310 310
                     $field->setValue($this->instance->getAttribute($name));
311 311
                 }
312 312
 
313 313
                 $fields[$arrayKey][$name] = $field;
314 314
 
315
-                if (! empty($config['form_type']) && $config['form_type'] === 'file') {
315
+                if (!empty($config['form_type']) && $config['form_type'] === 'file') {
316 316
                     $field = $this->fieldFactory
317 317
                         ->setColumn($column)
318 318
                         ->setConfig([
319
-                            'name'         => $name . '__delete',
319
+                            'name'         => $name.'__delete',
320 320
                             'presentation' => null,
321 321
                             'form_type'    => 'checkbox',
322 322
                             'no_validate'  => true,
323 323
                             'functions'    => null
324 324
                         ])
325 325
                         ->get();
326
-                    $fields[$arrayKey][$name . '__delete'] = $field;
326
+                    $fields[$arrayKey][$name.'__delete'] = $field;
327 327
                 }
328 328
             }
329 329
         }
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
     {
361 361
         /** @var \ANavallaSuiza\Laravel\Database\Contracts\Manager\ModelManager $modelManager */
362 362
         $modelManager = App::make('ANavallaSuiza\Laravel\Database\Contracts\Manager\ModelManager');
363
-        if (! empty($this->instance)) {
363
+        if (!empty($this->instance)) {
364 364
             $item = $this->instance;
365 365
         } else {
366 366
             $item = $modelManager->getModelInstance($this->getModel());
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
             return;
373 373
         }
374 374
 
375
-        if (! empty($fields['main'])) {
375
+        if (!empty($fields['main'])) {
376 376
             $skip = null;
377 377
             foreach ($fields['main'] as $key => $field) {
378 378
                 /** @var FieldContract $field */
@@ -395,20 +395,20 @@  discard block
 block discarded – undo
395 395
 
396 396
                 if (get_class($field->getFormField()) === \FormManager\Fields\File::class) {
397 397
                     $handleResult = $this->handleField($request, $item, $fields['main'], 'main', $fieldName);
398
-                    if (! empty($handleResult['skip'])) {
398
+                    if (!empty($handleResult['skip'])) {
399 399
                         $skip = $handleResult['skip'];
400 400
                     }
401
-                    if (! empty($handleResult['requestValue'])) {
401
+                    if (!empty($handleResult['requestValue'])) {
402 402
                         $requestValue = $handleResult['requestValue'];
403 403
                     }
404 404
                 }
405 405
 
406 406
 
407
-                if (! $field->saveIfEmpty() && empty($requestValue)) {
407
+                if (!$field->saveIfEmpty() && empty($requestValue)) {
408 408
                     continue;
409 409
                 }
410 410
 
411
-                if (! empty($requestValue)) {
411
+                if (!empty($requestValue)) {
412 412
                     $item->setAttribute(
413 413
                         $fieldName,
414 414
                         $field->applyFunctions($requestValue)
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
         $this->setInstance($item);
423 423
 
424 424
 
425
-        if (! empty($relations = $this->getRelations())) {
425
+        if (!empty($relations = $this->getRelations())) {
426 426
             foreach ($relations as $relationKey => $relation) {
427 427
                 if ($relation instanceof Collection) {
428 428
                     $input = $request->input($relationKey);
Please login to merge, or discard this patch.