Completed
Push — master ( c4b33f...ee2ad8 )
by
unknown
05:46
created
src/Abstractor/Eloquent/Model.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -123,13 +123,13 @@  discard block
 block discarded – undo
123 123
         }
124 124
 
125 125
         $customDisplayedColumns = $this->getConfigValue($action, 'display');
126
-        $customHiddenColumns = $this->getConfigValue($action, 'hide') ? : [];
126
+        $customHiddenColumns = $this->getConfigValue($action, 'hide') ?: [];
127 127
 
128 128
         $columns = array();
129
-        if (! empty($customDisplayedColumns) && is_array($customDisplayedColumns)) {
129
+        if (!empty($customDisplayedColumns) && is_array($customDisplayedColumns)) {
130 130
             foreach ($customDisplayedColumns as $customColumn) {
131
-                if (! array_key_exists($customColumn, $tableColumns)) {
132
-                    throw new AbstractorException("Column " . $customColumn . " does not exist on " . $this->getModel());
131
+                if (!array_key_exists($customColumn, $tableColumns)) {
132
+                    throw new AbstractorException("Column ".$customColumn." does not exist on ".$this->getModel());
133 133
                 }
134 134
 
135 135
                 $columns[$customColumn] = $tableColumns[$customColumn];
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 
161 161
         $relations = collect();
162 162
 
163
-        if (! empty($configRelations)) {
163
+        if (!empty($configRelations)) {
164 164
             foreach ($configRelations as $relationName => $configRelation) {
165 165
                 if (is_int($relationName)) {
166 166
                     $relationName = $configRelation;
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 
169 169
                 $config = [];
170 170
                 if ($configRelation !== $relationName) {
171
-                    if (! is_array($configRelation)) {
171
+                    if (!is_array($configRelation)) {
172 172
                         $config['type'] = $configRelation;
173 173
                     } else {
174 174
                         $config = $configRelation;
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
                 $secondaryRelations = $relation->getSecondaryRelations();
184 184
 
185 185
 
186
-                if (! $secondaryRelations->isEmpty()) {
186
+                if (!$secondaryRelations->isEmpty()) {
187 187
                     $relations->put($relationName,
188 188
                         collect(['relation' => $relation, 'secondaryRelations' => $secondaryRelations]));
189 189
                 } else {
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
     {
206 206
         $columns = $this->getColumns('list');
207 207
 
208
-        $fieldsPresentation = $this->getConfigValue('fields_presentation') ? : [];
208
+        $fieldsPresentation = $this->getConfigValue('fields_presentation') ?: [];
209 209
 
210 210
         $fields = array();
211 211
         foreach ($columns as $name => $column) {
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
     {
241 241
         $columns = $this->getColumns('detail');
242 242
 
243
-        $fieldsPresentation = $this->getConfigValue('fields_presentation') ? : [];
243
+        $fieldsPresentation = $this->getConfigValue('fields_presentation') ?: [];
244 244
 
245 245
         $fields = array();
246 246
         foreach ($columns as $name => $column) {
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 
281 281
         $fields = array();
282 282
         foreach ($columns as $name => $column) {
283
-            if (! in_array($name, $this->getReadOnlyColumns())) {
283
+            if (!in_array($name, $this->getReadOnlyColumns())) {
284 284
                 $presentation = null;
285 285
                 if (array_key_exists($name, $this->fieldsPresentation)) {
286 286
                     $presentation = $this->fieldsPresentation[$name];
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
                     ->setConfig($config)
302 302
                     ->get();
303 303
 
304
-                if (! empty($this->instance) && ! empty($this->instance->getAttribute($name))) {
304
+                if (!empty($this->instance) && !empty($this->instance->getAttribute($name))) {
305 305
                     $field->setValue($this->instance->getAttribute($name));
306 306
                 }
307 307
 
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
     {
342 342
         /** @var \ANavallaSuiza\Laravel\Database\Contracts\Manager\ModelManager $modelManager */
343 343
         $modelManager = App::make('ANavallaSuiza\Laravel\Database\Contracts\Manager\ModelManager');
344
-        if (! empty($this->instance)) {
344
+        if (!empty($this->instance)) {
345 345
             $item = $this->instance;
346 346
         } else {
347 347
             $item = $modelManager->getModelInstance($this->getModel());
@@ -353,29 +353,29 @@  discard block
 block discarded – undo
353 353
             return;
354 354
         }
355 355
 
356
-        if (! empty($fields['main'])) {
356
+        if (!empty($fields['main'])) {
357 357
             foreach ($fields['main'] as $field) {
358 358
                 $requestValue = $request->input("main.{$field->getName()}");
359 359
 
360
-                if (! $field->saveIfEmpty() && empty($requestValue)) {
360
+                if (!$field->saveIfEmpty() && empty($requestValue)) {
361 361
                     continue;
362 362
                 }
363 363
 
364 364
                 if (get_class($field->getFormField()) === \FormManager\Fields\File::class) {
365 365
                     if ($request->hasFile($field->getName())) {
366
-                        $fileName = uniqid() . '.' . $request->file($field->getName())->getClientOriginalExtension();
367
-                        $modelFolder = $this->slug . DIRECTORY_SEPARATOR;
366
+                        $fileName = uniqid().'.'.$request->file($field->getName())->getClientOriginalExtension();
367
+                        $modelFolder = $this->slug.DIRECTORY_SEPARATOR;
368 368
 
369 369
                         $request->file($field->getName())->move(
370
-                            base_path(config('anavel-crud.uploads_path') . $modelFolder),
370
+                            base_path(config('anavel-crud.uploads_path').$modelFolder),
371 371
                             $fileName
372 372
                         );
373 373
 
374
-                        $requestValue = $modelFolder . $fileName;
374
+                        $requestValue = $modelFolder.$fileName;
375 375
                     }
376 376
                 }
377 377
 
378
-                if (! empty($requestValue)) {
378
+                if (!empty($requestValue)) {
379 379
                     $item->setAttribute(
380 380
                         $field->getName(),
381 381
                         $field->applyFunctions($requestValue)
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
         $this->setInstance($item);
390 390
 
391 391
 
392
-        if (! empty($relations = $this->getRelations())) {
392
+        if (!empty($relations = $this->getRelations())) {
393 393
             foreach ($relations as $relationKey => $relation) {
394 394
                 if ($relation instanceof Collection) {
395 395
                     $input = $request->input($relationKey);
Please login to merge, or discard this patch.