We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -2,8 +2,8 @@ |
||
2 | 2 | |
3 | 3 | namespace Backpack\CRUD\ModelTraits\SpatieTranslatable; |
4 | 4 | |
5 | -use Illuminate\Database\Eloquent\Model; |
|
6 | 5 | use Illuminate\Contracts\Events\Dispatcher; |
6 | +use Illuminate\Database\Eloquent\Model; |
|
7 | 7 | |
8 | 8 | class SluggableObserver extends \Cviebrock\EloquentSluggable\SluggableObserver |
9 | 9 | { |
@@ -2,9 +2,9 @@ |
||
2 | 2 | |
3 | 3 | namespace Backpack\CRUD\ModelTraits\SpatieTranslatable; |
4 | 4 | |
5 | -use Illuminate\Database\Eloquent\Model; |
|
6 | -use Illuminate\Database\Eloquent\Builder; |
|
7 | 5 | use Cviebrock\EloquentSluggable\Sluggable as OriginalSluggable; |
6 | +use Illuminate\Database\Eloquent\Builder; |
|
7 | +use Illuminate\Database\Eloquent\Model; |
|
8 | 8 | |
9 | 9 | trait Sluggable |
10 | 10 | { |
@@ -3,33 +3,33 @@ discard block |
||
3 | 3 | <label>{!! $field['label'] !!}</label> |
4 | 4 | @include('crud::inc.field_translatable_icon') |
5 | 5 | <?php |
6 | - $entity_model = $crud->getModel(); |
|
6 | + $entity_model = $crud->getModel(); |
|
7 | 7 | |
8 | - //short name for dependency fields |
|
9 | - $primary_dependency = $field['subfields']['primary']; |
|
10 | - $secondary_dependency = $field['subfields']['secondary']; |
|
8 | + //short name for dependency fields |
|
9 | + $primary_dependency = $field['subfields']['primary']; |
|
10 | + $secondary_dependency = $field['subfields']['secondary']; |
|
11 | 11 | |
12 | 12 | |
13 | - //all items with relation |
|
14 | - $dependencies = $primary_dependency['model']::with($primary_dependency['entity_secondary'])->get(); |
|
13 | + //all items with relation |
|
14 | + $dependencies = $primary_dependency['model']::with($primary_dependency['entity_secondary'])->get(); |
|
15 | 15 | |
16 | - $dependencyArray = []; |
|
16 | + $dependencyArray = []; |
|
17 | 17 | |
18 | - //convert dependency array to simple matrix ( prymary id as key and array with secondaries id ) |
|
19 | - foreach($dependencies as $primary){ |
|
20 | - $dependencyArray[$primary->id] = []; |
|
18 | + //convert dependency array to simple matrix ( prymary id as key and array with secondaries id ) |
|
19 | + foreach($dependencies as $primary){ |
|
20 | + $dependencyArray[$primary->id] = []; |
|
21 | 21 | foreach($primary->{$primary_dependency['entity_secondary']} as $secondary){ |
22 | 22 | $dependencyArray[$primary->id][] = $secondary->id; |
23 | 23 | } |
24 | - } |
|
24 | + } |
|
25 | 25 | |
26 | - //for update form, get initial state of the entity |
|
27 | - if( isset($id) && $id ){ |
|
26 | + //for update form, get initial state of the entity |
|
27 | + if( isset($id) && $id ){ |
|
28 | 28 | |
29 | 29 | //get entity with relations for primary dependency |
30 | 30 | $entity_dependencies = $entity_model->with($primary_dependency['entity']) |
31 | - ->with($primary_dependency['entity'].'.'.$primary_dependency['entity_secondary']) |
|
32 | - ->find($id); |
|
31 | + ->with($primary_dependency['entity'].'.'.$primary_dependency['entity_secondary']) |
|
32 | + ->find($id); |
|
33 | 33 | |
34 | 34 | $secondaries_from_primary = []; |
35 | 35 | |
@@ -40,22 +40,22 @@ discard block |
||
40 | 40 | |
41 | 41 | //create secondary dependency from primary relation, used to check what chekbox must be check from second checklist |
42 | 42 | if( old($primary_dependency['name']) ) { |
43 | - foreach( old($primary_dependency['name']) as $primary_item ){ |
|
43 | + foreach( old($primary_dependency['name']) as $primary_item ){ |
|
44 | 44 | foreach($dependencyArray[$primary_item] as $second_item ){ |
45 | 45 | $secondary_ids[$second_item] = $second_item; |
46 | 46 | } |
47 | - } |
|
47 | + } |
|
48 | 48 | }else{ //create dependecies from relation if not from validate error |
49 | - foreach( $primary_array as $primary_item ){ |
|
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']; |
52 | 52 | } |
53 | - } |
|
53 | + } |
|
54 | + } |
|
54 | 55 | } |
55 | - } |
|
56 | 56 | |
57 | - //json encode of dependency matrix |
|
58 | - $dependencyJson = json_encode($dependencyArray); |
|
57 | + //json encode of dependency matrix |
|
58 | + $dependencyJson = json_encode($dependencyArray); |
|
59 | 59 | ?> |
60 | 60 | <script> |
61 | 61 | var {{ $field['field_unique_name'] }} = {!! $dependencyJson !!}; |