We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -2,34 +2,34 @@ discard block |
||
| 2 | 2 | <div class="form-group checklist_dependency" data-entity ="{{ $field['field_unique_name'] }}"> |
| 3 | 3 | <label>{{ $field['label'] }}</label> |
| 4 | 4 | <?php |
| 5 | - $entity_model = $crud->getModel(); |
|
| 5 | + $entity_model = $crud->getModel(); |
|
| 6 | 6 | |
| 7 | - //short name for dependency fields |
|
| 8 | - $primary_dependency = $field['subfields']['primary']; |
|
| 9 | - $secondary_dependency = $field['subfields']['secondary']; |
|
| 7 | + //short name for dependency fields |
|
| 8 | + $primary_dependency = $field['subfields']['primary']; |
|
| 9 | + $secondary_dependency = $field['subfields']['secondary']; |
|
| 10 | 10 | |
| 11 | 11 | |
| 12 | - //all items with relation |
|
| 13 | - $dependencies = $primary_dependency['model']::with($primary_dependency['entity_secondary'])->get(); |
|
| 12 | + //all items with relation |
|
| 13 | + $dependencies = $primary_dependency['model']::with($primary_dependency['entity_secondary'])->get(); |
|
| 14 | 14 | |
| 15 | - $dependencyArray = []; |
|
| 15 | + $dependencyArray = []; |
|
| 16 | 16 | |
| 17 | - //convert dependency array to simple matrix ( prymary id as key and array with secondaries id ) |
|
| 18 | - foreach($dependencies as $primary){ |
|
| 19 | - $dependencyArray[$primary->id] = []; |
|
| 17 | + //convert dependency array to simple matrix ( prymary id as key and array with secondaries id ) |
|
| 18 | + foreach($dependencies as $primary){ |
|
| 19 | + $dependencyArray[$primary->id] = []; |
|
| 20 | 20 | foreach($primary->{$primary_dependency['entity_secondary']} as $secondary){ |
| 21 | 21 | $dependencyArray[$primary->id][] = $secondary->id; |
| 22 | 22 | } |
| 23 | - } |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | - //for update form, get initial state of the entity |
|
| 26 | - if( isset($id) && $id ){ |
|
| 25 | + //for update form, get initial state of the entity |
|
| 26 | + if( isset($id) && $id ){ |
|
| 27 | 27 | |
| 28 | 28 | //get entity with relations for primary dependency |
| 29 | 29 | $entity_dependencies = $entity_model->with($primary_dependency['entity']) |
| 30 | - ->with($primary_dependency['entity'].'.'.$primary_dependency['entity_secondary']) |
|
| 31 | - ->where('id', $id) |
|
| 32 | - ->first(); |
|
| 30 | + ->with($primary_dependency['entity'].'.'.$primary_dependency['entity_secondary']) |
|
| 31 | + ->where('id', $id) |
|
| 32 | + ->first(); |
|
| 33 | 33 | |
| 34 | 34 | $secondaries_from_primary = []; |
| 35 | 35 | |
@@ -40,23 +40,23 @@ 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 | 57 | |
| 58 | - //json encode of dependency matrix |
|
| 59 | - $dependencyJson = json_encode($dependencyArray); |
|
| 58 | + //json encode of dependency matrix |
|
| 59 | + $dependencyJson = json_encode($dependencyArray); |
|
| 60 | 60 | ?> |
| 61 | 61 | <script> |
| 62 | 62 | var {{ $field['field_unique_name'] }} = {!! $dependencyJson !!}; |
@@ -2,14 +2,12 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Backpack\CRUD\app\Http\Controllers; |
| 4 | 4 | |
| 5 | -use Backpack\CRUD\app\Http\Requests\CrudRequest as StoreRequest; |
|
| 6 | -use Backpack\CRUD\app\Http\Requests\CrudRequest as UpdateRequest; |
|
| 7 | 5 | use Backpack\CRUD\Crud; |
| 6 | +use Backpack\CRUD\app\Http\Requests\CrudRequest as UpdateRequest; |
|
| 8 | 7 | use Illuminate\Foundation\Bus\DispatchesJobs; |
| 9 | 8 | use Illuminate\Foundation\Validation\ValidatesRequests; |
| 10 | 9 | // VALIDATION: change the requests to match your own file names if you need form validation |
| 11 | 10 | use Illuminate\Routing\Controller as BaseController; |
| 12 | -use Illuminate\Support\Facades\Form as Form; |
|
| 13 | 11 | |
| 14 | 12 | class CrudController extends BaseController |
| 15 | 13 | { |
@@ -1,10 +1,10 @@ |
||
| 1 | 1 | {{-- checkbox with loose false/null/0 checking --}} |
| 2 | 2 | <?php |
| 3 | - $icon = "fa-check-square-o"; |
|
| 4 | - if (strip_tags($entry->{$column['name']}) == false) |
|
| 5 | - { |
|
| 6 | - $icon = "fa-square-o"; |
|
| 7 | - } |
|
| 3 | + $icon = "fa-check-square-o"; |
|
| 4 | + if (strip_tags($entry->{$column['name']}) == false) |
|
| 5 | + { |
|
| 6 | + $icon = "fa-square-o"; |
|
| 7 | + } |
|
| 8 | 8 | ?> |
| 9 | 9 | |
| 10 | 10 | <td> |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | {{-- custom return value via attribute --}} |
| 2 | 2 | <td> |
| 3 | 3 | <?php |
| 4 | - echo $entry->{$column['function_name']}()->{$column['attribute']}; |
|
| 4 | + echo $entry->{$column['function_name']}()->{$column['attribute']}; |
|
| 5 | 5 | ?> |
| 6 | 6 | </td> |
| 7 | 7 | \ No newline at end of file |
@@ -1,8 +1,8 @@ |
||
| 1 | 1 | {{-- single relationships (1-1, 1-n) --}} |
| 2 | 2 | <td> |
| 3 | 3 | <?php |
| 4 | - if ($entry->{$column['entity']}()->getResults()) { |
|
| 5 | - echo $entry->{$column['entity']}()->getResults()->{$column['attribute']}; |
|
| 6 | - } |
|
| 7 | - ?> |
|
| 4 | + if ($entry->{$column['entity']}()->getResults()) { |
|
| 5 | + echo $entry->{$column['entity']}()->getResults()->{$column['attribute']}; |
|
| 6 | + } |
|
| 7 | + ?> |
|
| 8 | 8 | </td> |
| 9 | 9 | \ No newline at end of file |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | {{-- custom return value --}} |
| 2 | 2 | <td> |
| 3 | 3 | <?php |
| 4 | - echo $entry->{$column['function_name']}(); |
|
| 4 | + echo $entry->{$column['function_name']}(); |
|
| 5 | 5 | ?> |
| 6 | 6 | </td> |
| 7 | 7 | \ No newline at end of file |
@@ -1,12 +1,12 @@ |
||
| 1 | 1 | {{-- enumerate the values in an array --}} |
| 2 | 2 | <td> |
| 3 | 3 | <?php |
| 4 | - $value = $entry->{$column['name']}; |
|
| 4 | + $value = $entry->{$column['name']}; |
|
| 5 | 5 | |
| 6 | - // the value should be an array wether or not attribute casting is used |
|
| 7 | - if (!is_array($value)) { |
|
| 8 | - $value = json_decode($value, true); |
|
| 9 | - } |
|
| 6 | + // the value should be an array wether or not attribute casting is used |
|
| 7 | + if (!is_array($value)) { |
|
| 8 | + $value = json_decode($value, true); |
|
| 9 | + } |
|
| 10 | 10 | |
| 11 | 11 | if ($value && count($value)) { |
| 12 | 12 | echo implode(', ', $value); |
@@ -20,42 +20,42 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | @section('content') |
| 22 | 22 | <?php |
| 23 | - function tree_element($entry, $key, $all_entries, $crud) |
|
| 24 | - { |
|
| 23 | + function tree_element($entry, $key, $all_entries, $crud) |
|
| 24 | + { |
|
| 25 | 25 | if (!isset($entry->tree_element_shown)) { |
| 26 | - // mark the element as shown |
|
| 27 | - $all_entries[$key]->tree_element_shown = true; |
|
| 28 | - $entry->tree_element_shown = true; |
|
| 26 | + // mark the element as shown |
|
| 27 | + $all_entries[$key]->tree_element_shown = true; |
|
| 28 | + $entry->tree_element_shown = true; |
|
| 29 | 29 | |
| 30 | - // show the tree element |
|
| 31 | - echo '<li id="list_'.$entry->getKey().'">'; |
|
| 32 | - echo '<div><span class="disclose"><span></span></span>'.$entry->{$crud->reorder_label}.'</div>'; |
|
| 30 | + // show the tree element |
|
| 31 | + echo '<li id="list_'.$entry->getKey().'">'; |
|
| 32 | + echo '<div><span class="disclose"><span></span></span>'.$entry->{$crud->reorder_label}.'</div>'; |
|
| 33 | 33 | |
| 34 | - // see if this element has any children |
|
| 35 | - $children = []; |
|
| 36 | - foreach ($all_entries as $key => $subentry) { |
|
| 34 | + // see if this element has any children |
|
| 35 | + $children = []; |
|
| 36 | + foreach ($all_entries as $key => $subentry) { |
|
| 37 | 37 | if ($subentry->parent_id == $entry->getKey()) { |
| 38 | - $children[] = $subentry; |
|
| 38 | + $children[] = $subentry; |
|
| 39 | + } |
|
| 39 | 40 | } |
| 40 | - } |
|
| 41 | 41 | |
| 42 | - $children = collect($children)->sortBy('lft'); |
|
| 42 | + $children = collect($children)->sortBy('lft'); |
|
| 43 | 43 | |
| 44 | - // if it does have children, show them |
|
| 45 | - if (count($children)) { |
|
| 44 | + // if it does have children, show them |
|
| 45 | + if (count($children)) { |
|
| 46 | 46 | echo '<ol>'; |
| 47 | 47 | foreach ($children as $key => $child) { |
| 48 | - $children[$key] = tree_element($child, $child->getKey(), $all_entries, $crud); |
|
| 48 | + $children[$key] = tree_element($child, $child->getKey(), $all_entries, $crud); |
|
| 49 | 49 | } |
| 50 | 50 | echo '</ol>'; |
| 51 | - } |
|
| 52 | - echo '</li>'; |
|
| 51 | + } |
|
| 52 | + echo '</li>'; |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | return $entry; |
| 56 | - } |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - ?> |
|
| 58 | + ?> |
|
| 59 | 59 | <div class="row"> |
| 60 | 60 | <div class="col-md-8 col-md-offset-2"> |
| 61 | 61 | @if ($crud->hasAccess('list')) |
@@ -73,15 +73,15 @@ discard block |
||
| 73 | 73 | |
| 74 | 74 | <ol class="sortable"> |
| 75 | 75 | <?php |
| 76 | - $all_entries = collect($entries->all())->sortBy('lft')->keyBy($crud->getModel()->getKeyName()); |
|
| 77 | - $root_entries = $all_entries->filter(function($item) { |
|
| 76 | + $all_entries = collect($entries->all())->sortBy('lft')->keyBy($crud->getModel()->getKeyName()); |
|
| 77 | + $root_entries = $all_entries->filter(function($item) { |
|
| 78 | 78 | return $item->parent_id == 0; |
| 79 | - }); |
|
| 80 | - ?> |
|
| 79 | + }); |
|
| 80 | + ?> |
|
| 81 | 81 | @foreach ($root_entries as $key => $entry) |
| 82 | 82 | <?php |
| 83 | 83 | $root_entries[$key] = tree_element($entry, $key, $all_entries, $crud); |
| 84 | - ?> |
|
| 84 | + ?> |
|
| 85 | 85 | @endforeach |
| 86 | 86 | </ol> |
| 87 | 87 | |
@@ -89,33 +89,33 @@ |
||
| 89 | 89 | Route::post($name.'/search', [ |
| 90 | 90 | 'as' => 'crud.'.$name.'.search', |
| 91 | 91 | 'uses' => $controller.'@search', |
| 92 | - ]); |
|
| 92 | + ]); |
|
| 93 | 93 | Route::get($name.'/reorder', [ |
| 94 | 94 | 'as' => 'crud.'.$name.'.reorder', |
| 95 | 95 | 'uses' => $controller.'@reorder', |
| 96 | - ]); |
|
| 96 | + ]); |
|
| 97 | 97 | Route::post($name.'/reorder', [ |
| 98 | 98 | 'as' => 'crud.'.$name.'.save.reorder', |
| 99 | 99 | 'uses' => $controller.'@saveReorder', |
| 100 | - ]); |
|
| 100 | + ]); |
|
| 101 | 101 | Route::get($name.'/{id}/details', [ |
| 102 | 102 | 'as' => 'crud.'.$name.'.showDetailsRow', |
| 103 | 103 | 'uses' => $controller.'@showDetailsRow', |
| 104 | - ]); |
|
| 104 | + ]); |
|
| 105 | 105 | Route::get($name.'/{id}/translate/{lang}', [ |
| 106 | 106 | 'as' => 'crud.'.$name.'.translateItem', |
| 107 | 107 | 'uses' => $controller.'@translateItem', |
| 108 | - ]); |
|
| 108 | + ]); |
|
| 109 | 109 | |
| 110 | 110 | Route::get($name.'/{id}/revisions', [ |
| 111 | 111 | 'as' => 'crud.'.$name.'.listRevisions', |
| 112 | 112 | 'uses' => $controller.'@listRevisions', |
| 113 | - ]); |
|
| 113 | + ]); |
|
| 114 | 114 | |
| 115 | 115 | Route::post($name.'/{id}/revisions/{revisionId}/restore', [ |
| 116 | 116 | 'as' => 'crud.'.$name.'.restoreRevision', |
| 117 | 117 | 'uses' => $controller.'@restoreRevision', |
| 118 | - ]); |
|
| 118 | + ]); |
|
| 119 | 119 | |
| 120 | 120 | $options_with_default_route_names = array_merge([ |
| 121 | 121 | 'names' => [ |