Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Completed
Push — master ( 3d2fec...3195c5 )
by Cristian
02:59
created
src/resources/views/list.blade.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -71,8 +71,7 @@
 block discarded – undo
71 71
                             if ($results && $results->count()) {
72 72
                                 $results_array = $results->lists($column['attribute'], 'id');
73 73
                                 echo implode(', ', $results_array->toArray());
74
-                                }
75
-                                else
74
+                                } else
76 75
                                 {
77 76
                                 echo '-';
78 77
                                 }
Please login to merge, or discard this patch.
src/app/Http/Controllers/CrudController.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -161,7 +161,7 @@
 block discarded – undo
161 161
 	 * Remove the specified resource from storage.
162 162
 	 *
163 163
 	 * @param  int  $id
164
-	 * @return string
164
+	 * @return \Illuminate\Http\Response
165 165
 	 */
166 166
 	public function destroy($id)
167 167
 	{
Please login to merge, or discard this patch.
src/app/Http/Controllers/ToneCrudNestedController.php 1 patch
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
      * Store a newly created resource in storage.
55 55
      *
56 56
      * @param  \Illuminate\Http\Request  $request
57
-     * @return \Illuminate\Http\Response
57
+     * @return \Illuminate\Http\RedirectResponse
58 58
      */
59 59
     public function crudStore(Request $request = null)
60 60
     {
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
      *
102 102
      * @param  \Illuminate\Http\Request  $request
103 103
      * @param  int  $id
104
-     * @return \Illuminate\Http\Response
104
+     * @return \Illuminate\Http\RedirectResponse
105 105
      */
106 106
     public function crudUpdate($parentId, $id, Request $request = null)
107 107
     {
Please login to merge, or discard this patch.
src/Crud.php 2 patches
Doc Comments   +24 added lines, -2 removed lines patch added patch discarded remove patch
@@ -286,6 +286,7 @@  discard block
 block discarded – undo
286 286
      * Delete a row from the database.
287 287
      *
288 288
      * @param  [int] The id of the item to be deleted.
289
+     * @param integer $id
289 290
      * @return [bool] Deletion confirmation.
290 291
      *
291 292
      * TODO: should this delete items with relations to it too?
@@ -404,7 +405,8 @@  discard block
 block discarded – undo
404 405
      * Check if a permission is enabled for a Crud Panel. Fail if not.
405 406
      *
406 407
      * @param  [string] Permission.
407
-     * @return boolean
408
+     * @param string $permission
409
+     * @return boolean|null
408 410
      */
409 411
     public function hasAccessOrFail($permission)
410 412
     {
@@ -433,6 +435,7 @@  discard block
 block discarded – undo
433 435
      * All Create-Read-Update-Delete operations are done using that Eloquent Collection.
434 436
      *
435 437
      * @param [string] Full model namespace. Ex: App\Models\Article
438
+     * @param string $model_namespace
436 439
      */
437 440
     public function setModel($model_namespace)
438 441
     {
@@ -460,6 +463,7 @@  discard block
 block discarded – undo
460 463
      *
461 464
      * @param [string] Route name.
462 465
      * @param [array] Parameters.
466
+     * @param string $route
463 467
      */
464 468
     public function setRoute($route)
465 469
     {
@@ -492,7 +496,7 @@  discard block
 block discarded – undo
492 496
      * - $this->crud->setRouteName('admin.article')
493 497
      * - $this->crud->route = "admin/article"
494 498
      *
495
-     * @return [string]
499
+     * @return string
496 500
      */
497 501
     public function getRoute()
498 502
     {
@@ -505,6 +509,8 @@  discard block
 block discarded – undo
505 509
      *
506 510
      * @param [string] Entity name, in singular. Ex: article
507 511
      * @param [string] Entity name, in plural. Ex: articles
512
+     * @param string $singular
513
+     * @param string $plural
508 514
      */
509 515
     public function setEntityNameStrings($singular, $plural) {
510 516
         $this->entity_name = $singular;
@@ -1237,6 +1243,9 @@  discard block
 block discarded – undo
1237 1243
         return array_filter($this->{$entity}[] = $this->syncField($field));
1238 1244
     }
1239 1245
 
1246
+    /**
1247
+     * @param string $entity
1248
+     */
1240 1249
     public function addMultiple($entity, $field)
1241 1250
     {
1242 1251
         $this->{$entity} = array_filter(array_map([$this, 'syncField'], $fields));
@@ -1256,16 +1265,25 @@  discard block
 block discarded – undo
1256 1265
 
1257 1266
 
1258 1267
 
1268
+    /**
1269
+     * @param string $entity
1270
+     */
1259 1271
     public function remove($entity, $fields)
1260 1272
     {
1261 1273
         return array_values(array_filter($this->{$entity}, function($field) use ($fields) { return !in_array($field['name'], (array)$fields);}));
1262 1274
     }
1263 1275
 
1276
+    /**
1277
+     * @param string $items
1278
+     */
1264 1279
     public function setSort($items, $order)
1265 1280
     {
1266 1281
         $this->sort[$items] = $order;
1267 1282
     }
1268 1283
 
1284
+    /**
1285
+     * @param string $items
1286
+     */
1269 1287
     public function sort($items)
1270 1288
     {
1271 1289
         if (array_key_exists($items, $this->sort))
@@ -1301,6 +1319,10 @@  discard block
 block discarded – undo
1301 1319
     }
1302 1320
 
1303 1321
     // face un fel de merge intre ce ii dai si ce e in CRUD
1322
+
1323
+    /**
1324
+     * @param string $entity
1325
+     */
1304 1326
     public function syncRelations($entity)
1305 1327
     {
1306 1328
         foreach ($this->relations as $field => $relation) {
Please login to merge, or discard this patch.
Braces   +48 added lines, -21 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
     {
94 94
         if( $form == 'create' ){
95 95
             $fields = empty($this->create_fields)?$this->fields:$this->create_fields;
96
-        }else{
96
+        } else{
97 97
             $fields = empty($this->update_fields)?$this->fields:$this->update_fields;
98 98
         }
99 99
 
@@ -121,11 +121,11 @@  discard block
 block discarded – undo
121 121
                     foreach($relation['name'] as $relation){
122 122
                         if(isset($data[$relation])){
123 123
                             $model->{$relation}()->sync($data[$relation]);
124
-                        }else{
124
+                        } else{
125 125
                              $model->{$relation}()->sync([]);
126 126
                         }
127 127
                     }
128
-                }else{
128
+                } else{
129 129
                     $model->{$relation['name']}()->sync($data[$relation['name']]);
130 130
                 }
131 131
 
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
                         $fields[$k]['value'][] = $entry->{$relation};
304 304
                     }
305 305
                 
306
-                }else{
306
+                } else{
307 307
                     $fields[$k]['value'] = $entry->{$field['name']};
308 308
                 }
309 309
             }
@@ -482,7 +482,9 @@  discard block
 block discarded – undo
482 482
      */
483 483
     public function setModel($model_namespace)
484 484
     {
485
-        if (!class_exists($model_namespace)) throw new \Exception('This model does not exist.', 404);
485
+        if (!class_exists($model_namespace)) {
486
+            throw new \Exception('This model does not exist.', 404);
487
+        }
486 488
 
487 489
         $this->model = new $model_namespace();
488 490
         $this->query = $this->model->select('*');
@@ -524,7 +526,9 @@  discard block
 block discarded – undo
524 526
     {
525 527
         $complete_route = $route.'.index';
526 528
 
527
-        if (!\Route::has($complete_route)) throw new \Exception('There are no routes for this route name.', 404);
529
+        if (!\Route::has($complete_route)) {
530
+            throw new \Exception('There are no routes for this route name.', 404);
531
+        }
528 532
 
529 533
         $this->route = route($complete_route, $parameters);
530 534
         $this->initButtons();
@@ -580,8 +584,7 @@  discard block
 block discarded – undo
580 584
                 // if label and other details have been defined in the array
581 585
                 if (is_array($columns[0])) {
582 586
                     $this->addColumn($column);
583
-                }
584
-                else
587
+                } else
585 588
                 {
586 589
                     $this->addColumn([
587 590
                                     'name' => $column,
@@ -877,11 +880,17 @@  discard block
 block discarded – undo
877 880
      */
878 881
     public function getFieldTypeFromDbColumnType($field)
879 882
     {
880
-        if (!array_key_exists($field, $this->field_types)) return 'text';
883
+        if (!array_key_exists($field, $this->field_types)) {
884
+            return 'text';
885
+        }
881 886
 
882
-        if ($field == 'password') return 'password';
887
+        if ($field == 'password') {
888
+            return 'password';
889
+        }
883 890
 
884
-        if ($field == 'email') return 'email';
891
+        if ($field == 'email') {
892
+            return 'email';
893
+        }
885 894
 
886 895
         switch ($this->field_types[$field]['type'])
887 896
         {
@@ -954,7 +963,9 @@  discard block
 block discarded – undo
954 963
         $columns = \Schema::getColumnListing($this->model->getTable());
955 964
         $fillable = $this->model->getFillable();
956 965
 
957
-        if (!empty($fillable)) $columns = array_intersect($columns, $fillable);
966
+        if (!empty($fillable)) {
967
+            $columns = array_intersect($columns, $fillable);
968
+        }
958 969
 
959 970
         // but not updated_at, deleted_at
960 971
         return array_values(array_diff($columns, [$this->model->getKeyName(), 'updated_at', 'deleted_at']));
@@ -1254,7 +1265,9 @@  discard block
 block discarded – undo
1254 1265
 
1255 1266
     public function syncField($field)
1256 1267
     {
1257
-        if (array_key_exists('name', (array)$field)) return array_merge(['type' => $this->getFieldTypeFromDbColumnType($field['name']), 'value' => '', 'default' => null, 'values' => [], 'attributes' => []], $field);
1268
+        if (array_key_exists('name', (array)$field)) {
1269
+            return array_merge(['type' => $this->getFieldTypeFromDbColumnType($field['name']), 'value' => '', 'default' => null, 'values' => [], 'attributes' => []], $field);
1270
+        }
1258 1271
 
1259 1272
         return false;
1260 1273
     }
@@ -1272,8 +1285,11 @@  discard block
 block discarded – undo
1272 1285
 
1273 1286
             foreach ($this->{$fields} as $key => $field)
1274 1287
             {
1275
-                if (array_key_exists($field['name'], $this->relations) && $this->relations[$field['name']]['pivot']) $this->{$fields}[$key]['value'] = $this->entry->{$this->relations[$field['name']]['name']}()->lists($this->relations[$field['name']]['model']->getKeyName())->toArray();
1276
-                    else $this->{$fields}[$key]['value'] = $this->entry->{$field['name']};
1288
+                if (array_key_exists($field['name'], $this->relations) && $this->relations[$field['name']]['pivot']) {
1289
+                    $this->{$fields}[$key]['value'] = $this->entry->{$this->relations[$field['name']]['name']}()->lists($this->relations[$field['name']]['model']->getKeyName())->toArray();
1290
+                } else {
1291
+                        $this->{$fields}[$key]['value'] = $this->entry->{$field['name']};
1292
+                    }
1277 1293
             }
1278 1294
         }
1279 1295
     }
@@ -1293,7 +1309,9 @@  discard block
 block discarded – undo
1293 1309
         if (!empty($this->{$type}))
1294 1310
         {
1295 1311
             $this->{$type} = array_map(function($field) use ($fields, $attributes) {
1296
-                if (in_array($field['name'], (array)$fields)) $field = array_merge($field, $attributes);
1312
+                if (in_array($field['name'], (array)$fields)) {
1313
+                    $field = array_merge($field, $attributes);
1314
+                }
1297 1315
 
1298 1316
                 return $field;
1299 1317
             }, $this->{$type});
@@ -1320,7 +1338,9 @@  discard block
 block discarded – undo
1320 1338
 
1321 1339
             foreach ($this->sort[$items] as $item)
1322 1340
             {
1323
-                if (is_numeric($key = array_search($item, array_column($this->{$items}, 'name')))) $elements[] = $this->{$items}[$key];
1341
+                if (is_numeric($key = array_search($item, array_column($this->{$items}, 'name')))) {
1342
+                    $elements[] = $this->{$items}[$key];
1343
+                }
1324 1344
             }
1325 1345
 
1326 1346
             return $this->{$items} = array_merge($elements, array_filter($this->{$items}, function($item) use($items) {return !in_array($item['name'], $this->sort[$items]);}));
@@ -1339,9 +1359,13 @@  discard block
 block discarded – undo
1339 1359
         $order = (array)$order;
1340 1360
         $values = $model->select('*');
1341 1361
 
1342
-        if (!empty($where)) call_user_func_array([$values, $where[0]], array_slice($where, 1));
1362
+        if (!empty($where)) {
1363
+            call_user_func_array([$values, $where[0]], array_slice($where, 1));
1364
+        }
1343 1365
 
1344
-        if (!empty($order)) call_user_func_array([$values, 'orderBy'], $order);
1366
+        if (!empty($order)) {
1367
+            call_user_func_array([$values, 'orderBy'], $order);
1368
+        }
1345 1369
 
1346 1370
         return $values->get()->lists($field, $model->getKeyName())->toArray();
1347 1371
     }
@@ -1350,8 +1374,11 @@  discard block
 block discarded – undo
1350 1374
     public function syncRelations($entity)
1351 1375
     {
1352 1376
         foreach ($this->relations as $field => $relation) {
1353
-            if ($relation['pivot']) $this->add($entity, ['name' => $field, 'type' => 'multiselect', 'value' => [], 'values' => $this->relations[$field]['values']]);
1354
-                else $this->sync($entity, $field, ['type' => 'select', 'values' => $this->relations[$field]['values']]);
1377
+            if ($relation['pivot']) {
1378
+                $this->add($entity, ['name' => $field, 'type' => 'multiselect', 'value' => [], 'values' => $this->relations[$field]['values']]);
1379
+            } else {
1380
+                    $this->sync($entity, $field, ['type' => 'select', 'values' => $this->relations[$field]['values']]);
1381
+                }
1355 1382
         }
1356 1383
     }
1357 1384
 
Please login to merge, or discard this patch.
src/ToneCrud.php 2 patches
Doc Comments   +25 added lines patch added patch discarded remove patch
@@ -38,6 +38,9 @@  discard block
 block discarded – undo
38 38
         $this->initState();
39 39
     }
40 40
 
41
+    /**
42
+     * @param string $model
43
+     */
41 44
     public function setModel($model)
42 45
     {
43 46
         if (!class_exists($model)) throw new \Exception('This model does not exist.', 404);
@@ -54,6 +57,10 @@  discard block
 block discarded – undo
54 57
     }
55 58
 
56 59
     // TODO: make this work without having to specify "index"
60
+
61
+    /**
62
+     * @param string $route
63
+     */
57 64
     public function setRoute($route, $parameters = [])
58 65
     {
59 66
         if (!\Route::has($route)) throw new \Exception('This route does not exist.', 404);
@@ -259,6 +266,9 @@  discard block
 block discarded – undo
259 266
         return $model;
260 267
     }
261 268
 
269
+    /**
270
+     * @param integer $id
271
+     */
262 272
     public function delete($id) // DONE
263 273
     {
264 274
         return $this->model->destroy($id);
@@ -489,6 +499,9 @@  discard block
 block discarded – undo
489 499
         return array_filter($this->{$entity}[] = $this->syncField($field));
490 500
     }
491 501
 
502
+    /**
503
+     * @param string $entity
504
+     */
492 505
     private function addMultiple($entity, $field)
493 506
     {
494 507
         $this->{$entity} = array_filter(array_map([$this, 'syncField'], $fields));
@@ -506,16 +519,25 @@  discard block
 block discarded – undo
506 519
         }
507 520
     }
508 521
 
522
+    /**
523
+     * @param string $entity
524
+     */
509 525
     private function remove($entity, $fields)
510 526
     {
511 527
         return array_values(array_filter($this->{$entity}, function($field) use ($fields) { return !in_array($field['name'], (array)$fields);}));
512 528
     }
513 529
 
530
+    /**
531
+     * @param string $items
532
+     */
514 533
     private function setSort($items, $order)
515 534
     {
516 535
         $this->sort[$items] = $order;
517 536
     }
518 537
 
538
+    /**
539
+     * @param string $items
540
+     */
519 541
     private function sort($items)
520 542
     {
521 543
         if (array_key_exists($items, $this->sort))
@@ -561,6 +583,9 @@  discard block
 block discarded – undo
561 583
         return $values->get()->lists($field, $model->getKeyName())->toArray();
562 584
     }
563 585
 
586
+    /**
587
+     * @param string $entity
588
+     */
564 589
     private function syncRelations($entity)
565 590
     {
566 591
         foreach ($this->relations as $field => $relation) {
Please login to merge, or discard this patch.
Braces   +64 added lines, -22 removed lines patch added patch discarded remove patch
@@ -40,7 +40,9 @@  discard block
 block discarded – undo
40 40
 
41 41
     public function setModel($model)
42 42
     {
43
-        if (!class_exists($model)) throw new \Exception('This model does not exist.', 404);
43
+        if (!class_exists($model)) {
44
+            throw new \Exception('This model does not exist.', 404);
45
+        }
44 46
 
45 47
         $this->model = new $model();
46 48
         $this->query = $this->model->select('*');
@@ -56,7 +58,9 @@  discard block
 block discarded – undo
56 58
     // TODO: make this work without having to specify "index"
57 59
     public function setRoute($route, $parameters = [])
58 60
     {
59
-        if (!\Route::has($route)) throw new \Exception('This route does not exist.', 404);
61
+        if (!\Route::has($route)) {
62
+            throw new \Exception('This route does not exist.', 404);
63
+        }
60 64
 
61 65
         $this->route = route($route, $parameters);
62 66
         $this->initButtons();
@@ -254,7 +258,9 @@  discard block
 block discarded – undo
254 258
     {
255 259
         $model = $this->model->findOrFail($id);
256 260
         $updated = $model->update($data);
257
-        if ($updated) $this->syncPivot($model, $data);
261
+        if ($updated) {
262
+            $this->syncPivot($model, $data);
263
+        }
258 264
 
259 265
         return $model;
260 266
     }
@@ -282,7 +288,9 @@  discard block
 block discarded – undo
282 288
 
283 289
     public function checkPermission($permission) // DONE
284 290
     {
285
-        if (!in_array($permission, $this->permissions)) abort(403);
291
+        if (!in_array($permission, $this->permissions)) {
292
+            abort(403);
293
+        }
286 294
     }
287 295
 
288 296
     public function unsetListActions($actions)
@@ -351,11 +359,17 @@  discard block
 block discarded – undo
351 359
 
352 360
         $this->state = 'list';
353 361
 
354
-        if (in_array('create', $segments)) $this->state = 'add';
362
+        if (in_array('create', $segments)) {
363
+            $this->state = 'add';
364
+        }
355 365
 
356
-        if (in_array('edit', $segments)) $this->state = 'edit';
366
+        if (in_array('edit', $segments)) {
367
+            $this->state = 'edit';
368
+        }
357 369
 
358
-        if (is_numeric(end($segments))) $this->state = 'view';
370
+        if (is_numeric(end($segments))) {
371
+            $this->state = 'view';
372
+        }
359 373
     }
360 374
 
361 375
     private function removeButtons($buttons)
@@ -373,21 +387,27 @@  discard block
 block discarded – undo
373 387
         $columns = \Schema::getColumnListing($this->model->getTable());
374 388
         $fillable = $this->model->getFillable();
375 389
 
376
-        if (!empty($fillable)) $columns = array_intersect($columns, $fillable);
390
+        if (!empty($fillable)) {
391
+            $columns = array_intersect($columns, $fillable);
392
+        }
377 393
 
378 394
         return array_values(array_diff($columns, [$this->model->getKeyName(), 'updated_at', 'deleted_at']));
379 395
     }
380 396
 
381 397
     private function syncColumn($column)
382 398
     {
383
-        if (array_key_exists('name', (array)$column)) return array_merge(['type' => $this->getType($column['name'])], $column);
399
+        if (array_key_exists('name', (array)$column)) {
400
+            return array_merge(['type' => $this->getType($column['name'])], $column);
401
+        }
384 402
 
385 403
         return false;
386 404
     }
387 405
 
388 406
     private function syncField($field)
389 407
     {
390
-        if (array_key_exists('name', (array)$field)) return array_merge(['type' => $this->getType($field['name']), 'value' => '', 'default' => null, 'values' => [], 'attributes' => []], $field);
408
+        if (array_key_exists('name', (array)$field)) {
409
+            return array_merge(['type' => $this->getType($field['name']), 'value' => '', 'default' => null, 'values' => [], 'attributes' => []], $field);
410
+        }
391 411
 
392 412
         return false;
393 413
     }
@@ -404,11 +424,17 @@  discard block
 block discarded – undo
404 424
 
405 425
     private function getType($field) // DONE
406 426
     {
407
-        if (!array_key_exists($field, $this->fieldTypes)) return 'text';
427
+        if (!array_key_exists($field, $this->fieldTypes)) {
428
+            return 'text';
429
+        }
408 430
 
409
-        if ($field == 'password') return 'password';
431
+        if ($field == 'password') {
432
+            return 'password';
433
+        }
410 434
 
411
-        if ($field == 'email') return 'email';
435
+        if ($field == 'email') {
436
+            return 'email';
437
+        }
412 438
 
413 439
         switch ($this->fieldTypes[$field]['type'])
414 440
         {
@@ -466,7 +492,9 @@  discard block
 block discarded – undo
466 492
 
467 493
             $this->fields[] = ['name' => $field, 'value' => '', 'default' => $this->fieldTypes[$field]['default'], 'type' => $this->getType($field), 'values' => [], 'attributes' => []];
468 494
 
469
-            if (!in_array($field, $this->model->getHidden())) $this->columns[] = ['name' => $field, 'type' => $this->getType($field)];
495
+            if (!in_array($field, $this->model->getHidden())) {
496
+                $this->columns[] = ['name' => $field, 'type' => $this->getType($field)];
497
+            }
470 498
         }, $this->getColumns());
471 499
     }
472 500
 
@@ -478,8 +506,11 @@  discard block
 block discarded – undo
478 506
 
479 507
             foreach ($this->{$fields} as $key => $field)
480 508
             {
481
-                if (array_key_exists($field['name'], $this->relations) && $this->relations[$field['name']]['pivot']) $this->{$fields}[$key]['value'] = $this->item->{$this->relations[$field['name']]['name']}()->lists($this->relations[$field['name']]['model']->getKeyName())->toArray();
482
-                    else $this->{$fields}[$key]['value'] = $this->item->{$field['name']};
509
+                if (array_key_exists($field['name'], $this->relations) && $this->relations[$field['name']]['pivot']) {
510
+                    $this->{$fields}[$key]['value'] = $this->item->{$this->relations[$field['name']]['name']}()->lists($this->relations[$field['name']]['model']->getKeyName())->toArray();
511
+                } else {
512
+                        $this->{$fields}[$key]['value'] = $this->item->{$field['name']};
513
+                    }
483 514
             }
484 515
         }
485 516
     }
@@ -499,7 +530,9 @@  discard block
 block discarded – undo
499 530
         if (!empty($this->{$type}))
500 531
         {
501 532
             $this->{$type} = array_map(function($field) use ($fields, $attributes) {
502
-                if (in_array($field['name'], (array)$fields)) $field = array_merge($field, $attributes);
533
+                if (in_array($field['name'], (array)$fields)) {
534
+                    $field = array_merge($field, $attributes);
535
+                }
503 536
 
504 537
                 return $field;
505 538
             }, $this->{$type});
@@ -524,7 +557,9 @@  discard block
 block discarded – undo
524 557
 
525 558
             foreach ($this->sort[$items] as $item)
526 559
             {
527
-                if (is_numeric($key = array_search($item, array_column($this->{$items}, 'name')))) $elements[] = $this->{$items}[$key];
560
+                if (is_numeric($key = array_search($item, array_column($this->{$items}, 'name')))) {
561
+                    $elements[] = $this->{$items}[$key];
562
+                }
528 563
             }
529 564
 
530 565
             return $this->{$items} = array_merge($elements, array_filter($this->{$items}, function($item) use($items) {return !in_array($item['name'], $this->sort[$items]);}));
@@ -554,9 +589,13 @@  discard block
 block discarded – undo
554 589
         $order = (array)$order;
555 590
         $values = $model->select('*');
556 591
 
557
-        if (!empty($where)) call_user_func_array([$values, $where[0]], array_slice($where, 1));
592
+        if (!empty($where)) {
593
+            call_user_func_array([$values, $where[0]], array_slice($where, 1));
594
+        }
558 595
 
559
-        if (!empty($order)) call_user_func_array([$values, 'orderBy'], $order);
596
+        if (!empty($order)) {
597
+            call_user_func_array([$values, 'orderBy'], $order);
598
+        }
560 599
 
561 600
         return $values->get()->lists($field, $model->getKeyName())->toArray();
562 601
     }
@@ -564,8 +603,11 @@  discard block
 block discarded – undo
564 603
     private function syncRelations($entity)
565 604
     {
566 605
         foreach ($this->relations as $field => $relation) {
567
-            if ($relation['pivot']) $this->add($entity, ['name' => $field, 'type' => 'multiselect', 'value' => [], 'values' => $this->relations[$field]['values']]);
568
-                else $this->sync($entity, $field, ['type' => 'select', 'values' => $this->relations[$field]['values']]);
606
+            if ($relation['pivot']) {
607
+                $this->add($entity, ['name' => $field, 'type' => 'multiselect', 'value' => [], 'values' => $this->relations[$field]['values']]);
608
+            } else {
609
+                    $this->sync($entity, $field, ['type' => 'select', 'values' => $this->relations[$field]['values']]);
610
+                }
569 611
         }
570 612
     }
571 613
 
Please login to merge, or discard this patch.
src/resources/views/fields/checklist_dependency.blade.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
                 $secondary_ids[$second_item] = $second_item;
46 46
             }
47 47
           }
48
-        }else{ //create dependecies from relation if not from validate error
48
+        } else{ //create dependecies from relation if not from validate error
49 49
           foreach( $primary_array as $primary_item ){
50 50
             foreach($primary_item[$secondary_dependency['entity']] as $second_item ){
51 51
                 $secondary_ids[$second_item['id']] = $second_item['id'];
Please login to merge, or discard this patch.