├── .gitignore ├── .styleci.yml ├── LICENSE ├── README.md ├── composer.json └── src ├── NestedCrudServiceProvider.php ├── app └── Http │ └── Controllers │ └── Operations │ ├── NestedCreateOperation.php │ ├── NestedDeleteOperation.php │ ├── NestedListOperation.php │ └── NestedUpdateOperation.php └── resources └── views ├── crud └── fields │ └── nested_crud.blade.php └── nested_crud ├── buttons ├── create.blade.php ├── delete.blade.php └── update.blade.php ├── inc └── column_wrapper_attributes.blade.php ├── modals ├── create.blade.php ├── edit.blade.php └── layout.blade.php ├── nested_grid_list.blade.php └── nested_list.blade.php /.gitignore: -------------------------------------------------------------------------------- 1 | vendor/ 2 | .php_cs.cache 3 | -------------------------------------------------------------------------------- /.styleci.yml: -------------------------------------------------------------------------------- 1 | preset: laravel 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 onkbear 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Backpack Nested Crud 2 | 3 | [![Latest Stable Version](https://img.shields.io/packagist/v/onkbear/backpack-nested-crud.svg?style=flat-square)](https://packagist.org/packages/onkbear/backpack-nested-crud) 4 | [![Software License](https://img.shields.io/github/license/onkbear/backpack-nested-crud?style=flat-square)](LICENSE) 5 | 6 | This package gives nested CRUD operations on your edit page. 7 | 8 | Inspired by [Nested resources in Backpack CRUD](https://backpackforlaravel.com/articles/tutorials/nested-resources-in-backpack-crud) 9 | 10 | E.g. 11 | 12 | Gives the avility of CRUD operations of `comment` model as a field on `user` edit page. 13 | 14 | For [Laravel-Backpack/CRUD](https://github.com/Laravel-Backpack/CRUD) v4.0, please use `^1.1`. 15 | 16 | ![Demo](https://user-images.githubusercontent.com/6011203/71384896-04b19080-25dc-11ea-9c97-6ee38d31619c.gif) 17 | 18 | ## Install 19 | 20 | ``` bash 21 | composer require onkbear/backpack-nested-crud 22 | ``` 23 | 24 | ## Usage 25 | 26 | There are four (instead of create, read, update, delete) nested CRUD operations. 27 | 28 | ``` php 29 | use \Onkbear\NestedCrud\app\Http\Controllers\Operations\NestedListOperation; 30 | use \Onkbear\NestedCrud\app\Http\Controllers\Operations\NestedCreateOperation; 31 | use \Onkbear\NestedCrud\app\Http\Controllers\Operations\NestedUpdateOperation; 32 | use \Onkbear\NestedCrud\app\Http\Controllers\Operations\NestedDeleteOperation; 33 | ``` 34 | 35 | ## Example 36 | 37 | Please create `User` model and `Comment` model with relationship. 38 | 39 | Please create `UserCrudController`. 40 | 41 | ```php 42 | class UserCrudController extends CrudController 43 | { 44 | use \Backpack\CRUD\app\Http\Controllers\Operations\ListOperation; 45 | use \Backpack\CRUD\app\Http\Controllers\Operations\CreateOperation; 46 | use \Backpack\CRUD\app\Http\Controllers\Operations\UpdateOperation; 47 | 48 | public function setup() 49 | { 50 | CRUD::setModel('App\Models\User'); 51 | CRUD::setRoute(config('backpack.base.route_prefix').'/user'); 52 | CRUD::setEntityNameStrings('user', 'users'); 53 | } 54 | 55 | protected function setupListOperation() 56 | { 57 | CRUD::addColumns(['name']); 58 | } 59 | 60 | protected function setupCreateOperation() 61 | { 62 | CRUD::addField([ 63 | 'name' => 'name', 64 | 'label' => 'Name', 65 | 'type' => 'text', 66 | 'tab' => 'Texts', 67 | ]); 68 | } 69 | 70 | protected function setupUpdateOperation() 71 | { 72 | $this->setupCreateOperation(); 73 | 74 | CRUD::addField([ 75 | 'name' => 'comments', 76 | 'label' => 'Comment', 77 | 'type' => 'nested_crud', 78 | 'target' => 'comment', 79 | 'model' => 'App\Models\Comment', 80 | 'tab' => 'Comments', // optional 81 | ]); 82 | } 83 | } 84 | 85 | ``` 86 | 87 | ### Create the CRUD controller 88 | 89 | ``` php 90 | use App\Http\Requests\CommentRequest as StoreRequest; 91 | use App\Http\Requests\CommentRequest as UpdateRequest; 92 | 93 | class UserCommentCrudController extends CrudController 94 | { 95 | use \Onkbear\NestedCrud\app\Http\Controllers\Operations\NestedListOperation; 96 | use \Onkbear\NestedCrud\app\Http\Controllers\Operations\NestedCreateOperation; 97 | use \Onkbear\NestedCrud\app\Http\Controllers\Operations\NestedUpdateOperation; 98 | use \Onkbear\NestedCrud\app\Http\Controllers\Operations\NestedDeleteOperation; 99 | 100 | public function setup() 101 | { 102 | // set the Eloquent object 103 | CRUD::setModel(\App\Models\Comment::class); 104 | 105 | // get the user_id parameter 106 | $userId = \Route::current()->parameter('user_id'); 107 | 108 | // set a different route for the admin panel buttons 109 | CRUD::setRoute(config('backpack.base.route_prefix').'/user/'.$userId.'/comment'); 110 | 111 | // show only specific user's comments 112 | CRUD::addClause('where', 'user_id', $userId); 113 | 114 | // ... 115 | } 116 | 117 | protected function setupNestedListOperation() 118 | { 119 | // ... 120 | } 121 | 122 | protected function setupNestedCreateOperation() 123 | { 124 | CRUD::setValidation(StoreRequest::class); 125 | 126 | // get the user_id parameter 127 | $userId = \Route::current()->parameter('user_id'); 128 | 129 | // add a foreign key field as a hidden field (may need only for create operation) 130 | CRUD::addField([ 131 | 'name' => 'user_id', 132 | 'type' => 'hidden', 133 | 'value' => $userId 134 | ]); 135 | 136 | // ... 137 | } 138 | 139 | protected function setupNestedUpdateOperation() 140 | { 141 | CRUD::setValidation(UpdateRequest::class); 142 | 143 | // ... 144 | } 145 | ``` 146 | 147 | ### Add the route 148 | 149 | Setup the route in `route/custom.php` 150 | 151 | ``` php 152 | Route::crud('user/', 'UserCrudController'); 153 | Route::group(['prefix' => 'user/{user_id}'], function() { 154 | Route::crud('comment', 'UserCommentCrudController'); 155 | }); 156 | ``` 157 | 158 | You have following routes. 159 | 160 | - `admin/user/` 161 | - `admin/user/{user_id}/comment/` 162 | 163 | That's it. 164 | 165 | You can also use backpack operations into `UserCommentCrudController` or extend `CommentCrudController` if it is exist. 166 | 167 | ## Customize views for list view 168 | 169 | There are two templates for list view. 170 | 171 | - `nested_crud::nested_list` : table view (default) 172 | - `nested_crud::nested_grid_list` : grid view 173 | 174 | ![Grid View](https://user-images.githubusercontent.com/6011203/71385071-15163b00-25dd-11ea-9b99-880d8f52af67.png) 175 | 176 | If you would like to use grid view, simply use the set method below. 177 | 178 | ``` php 179 | // UserCommentCrudController.php 180 | 181 | protected function setupNestedListOperation() 182 | { 183 | $this->crud->setListView('nested_crud::nested_grid_list'); 184 | } 185 | ``` 186 | 187 | If you created view files with exact same name in `resources/views/vendor/backpack/nested_crud` folder, it will override. 188 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "onkbear/backpack-nested-crud", 3 | "description": "", 4 | "keywords": [ 5 | "laravel backpack", 6 | "backpack", 7 | "crud" 8 | ], 9 | "homepage": "https://github.com/onkbear/backpack-nested-crud", 10 | "license": "MIT", 11 | "authors": [ 12 | { 13 | "name": "onkbear", 14 | "email": "onkbear@gmail.com" 15 | } 16 | ], 17 | "require": { 18 | "backpack/crud": "^4.1.0" 19 | }, 20 | "require-dev": { 21 | "friendsofphp/php-cs-fixer": "^2.16" 22 | }, 23 | "autoload": { 24 | "psr-4": { 25 | "Onkbear\\NestedCrud\\": "src/" 26 | } 27 | }, 28 | "extra": { 29 | "laravel": { 30 | "providers": [ 31 | "Onkbear\\NestedCrud\\NestedCrudServiceProvider" 32 | ] 33 | } 34 | }, 35 | "scripts": { 36 | "lint": [ 37 | "php-cs-fixer fix --dry-run ./src" 38 | ], 39 | "lint-fix": [ 40 | "php-cs-fixer fix ./src" 41 | ] 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/NestedCrudServiceProvider.php: -------------------------------------------------------------------------------- 1 | loadViewsFrom($customNestedCrudFolder, 'nested_crud'); 25 | } 26 | 27 | // load default views 28 | $this->loadViewsFrom(realpath(__DIR__.'/resources/views/crud'), 'crud'); 29 | $this->loadViewsFrom(realpath(__DIR__.'/resources/views/nested_crud'), 'nested_crud'); 30 | } 31 | 32 | /** 33 | * Register any package services. 34 | */ 35 | public function register(): void 36 | { 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/app/Http/Controllers/Operations/NestedCreateOperation.php: -------------------------------------------------------------------------------- 1 | $routeName.'.nestedCreate', 20 | 'uses' => $controller.'@nestedCreate', 21 | 'operation' => 'nestedCreate', 22 | ]); 23 | 24 | Route::post($segment.'/ajax', [ 25 | 'as' => $routeName.'.nestedStore', 26 | 'uses' => $controller.'@nestedStore', 27 | 'operation' => 'nestedCreate', 28 | ]); 29 | } 30 | 31 | /** 32 | * Add the default settings, buttons, etc that this operation needs. 33 | */ 34 | protected function setupNestedCreateDefaults() 35 | { 36 | $this->crud->allowAccess('create'); 37 | 38 | $this->crud->operation('nestedCreate', function () { 39 | $this->crud->setupDefaultSaveActions(); 40 | $this->crud->setCreateView('nested_crud::modals.create'); 41 | }); 42 | } 43 | 44 | /** 45 | * Show the form for creating inserting a new row. 46 | * 47 | * @return Response 48 | */ 49 | public function nestedCreate() 50 | { 51 | $this->crud->hasAccessOrFail('create'); 52 | 53 | // prepare the fields you need to show 54 | $this->data['crud'] = $this->crud; 55 | $this->data['saveAction'] = $this->crud->getSaveAction(); 56 | $this->data['title'] = $this->crud->getTitle() ?? trans('backpack::crud.add').' '.$this->crud->entity_name; 57 | 58 | // load the view from /resources/views/vendor/backpack/crud/ if it exists, otherwise load the one in the package 59 | return view($this->crud->getCreateView(), $this->data); 60 | } 61 | 62 | /** 63 | * Store a newly created resource in the database. 64 | * 65 | * @return string 66 | */ 67 | public function nestedStore() 68 | { 69 | $this->crud->hasAccessOrFail('create'); 70 | 71 | // execute the FormRequest authorization and validation, if one is required 72 | $request = $this->crud->validateRequest(); 73 | 74 | // insert item in the db 75 | $item = $this->crud->create($this->crud->getStrippedSaveRequest()); 76 | $this->data['entry'] = $this->crud->entry = $item; 77 | 78 | return $item->getKey(); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/app/Http/Controllers/Operations/NestedDeleteOperation.php: -------------------------------------------------------------------------------- 1 | $routeName.'.nestedDestroy', 20 | 'uses' => $controller.'@nestedDestroy', 21 | 'operation' => 'nestedDelete', 22 | ]); 23 | } 24 | 25 | /** 26 | * Add the default settings, buttons, etc that this operation needs. 27 | */ 28 | protected function setupNestedDeleteDefaults() 29 | { 30 | $this->crud->allowAccess('delete'); 31 | 32 | $this->crud->operation(['nestedList'], function () { 33 | $this->crud->addButton('line', 'nested_delete', 'view', 'nested_crud::buttons.delete', 'end'); 34 | }); 35 | } 36 | 37 | /** 38 | * Remove the specified resource from storage. 39 | * 40 | * @param int $id 41 | * 42 | * @return string 43 | */ 44 | public function nestedDestroy($id) 45 | { 46 | $this->crud->hasAccessOrFail('delete'); 47 | 48 | // get entry ID from Request (makes sure its the last ID for nested resources) 49 | $id = $this->crud->getCurrentEntryId() ?? $id; 50 | 51 | return $this->crud->delete($id); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/app/Http/Controllers/Operations/NestedListOperation.php: -------------------------------------------------------------------------------- 1 | $routeName.'.nestedList', 20 | 'uses' => $controller.'@nestedList', 21 | 'operation' => 'nestedList', 22 | ]); 23 | } 24 | 25 | /** 26 | * Add the default settings, buttons, etc that this operation needs. 27 | */ 28 | protected function setupNestedListDefaults() 29 | { 30 | $this->crud->allowAccess('list'); 31 | 32 | $this->crud->operation('nestedList', function () { 33 | $this->crud->setListView('nested_crud::nested_list'); 34 | }); 35 | } 36 | 37 | /** 38 | * Display all rows in the database for this entity. 39 | * 40 | * @return \Illuminate\View\View 41 | */ 42 | public function nestedList() 43 | { 44 | $this->crud->hasAccessOrFail('list'); 45 | 46 | $this->data['entries'] = $this->crud->getEntries(); 47 | $this->data['crud'] = $this->crud; 48 | 49 | return view($this->crud->getListView(), $this->data); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/app/Http/Controllers/Operations/NestedUpdateOperation.php: -------------------------------------------------------------------------------- 1 | $routeName.'.nestedEdit', 20 | 'uses' => $controller.'@nestedEdit', 21 | 'operation' => 'nestedUpdate', 22 | ]); 23 | 24 | Route::put($segment.'/ajax/{id}', [ 25 | 'as' => $routeName.'.nestedUpdate', 26 | 'uses' => $controller.'@nestedUpdate', 27 | 'operation' => 'nestedUpdate', 28 | ]); 29 | 30 | Route::get($segment.'/ajax/{id}/translate/{lang}', [ 31 | 'as' => $routeName.'.nestedTranslateItem', 32 | 'uses' => $controller.'@nestedTranslateItem', 33 | 'operation' => 'nestedUpdate', 34 | ]); 35 | } 36 | 37 | /** 38 | * Add the default settings, buttons, etc that this operation needs. 39 | */ 40 | protected function setupNestedUpdateDefaults() 41 | { 42 | $this->crud->allowAccess('update'); 43 | 44 | $this->crud->operation('nestedUpdate', function () { 45 | $this->crud->setUpdateView('nested_crud::modals.edit'); 46 | 47 | if ($this->crud->getModel()->translationEnabled()) { 48 | $this->crud->addField([ 49 | 'name' => 'locale', 50 | 'type' => 'hidden', 51 | 'value' => request()->input('locale') ?? app()->getLocale(), 52 | ]); 53 | } 54 | 55 | $this->crud->setupDefaultSaveActions(); 56 | }); 57 | 58 | $this->crud->operation(['nestedList'], function () { 59 | $this->crud->addButton('line', 'nested_update', 'view', 'nested_crud::buttons.update', 'end'); 60 | }); 61 | } 62 | 63 | /** 64 | * Show the form for editing the specified resource. 65 | * 66 | * @param int $id 67 | * 68 | * @return Response 69 | */ 70 | public function nestedEdit($id) 71 | { 72 | $this->crud->hasAccessOrFail('update'); 73 | 74 | // get entry ID from Request (makes sure its the last ID for nested resources) 75 | $id = $this->crud->getCurrentEntryId() ?? $id; 76 | $this->crud->setOperationSetting('fields', $this->crud->getUpdateFields()); 77 | 78 | // get the info for that entry 79 | $this->data['entry'] = $this->crud->getEntry($id); 80 | $this->data['crud'] = $this->crud; 81 | $this->data['saveAction'] = $this->crud->getSaveAction(); 82 | $this->data['title'] = $this->crud->getTitle() ?? trans('backpack::crud.edit').' '.$this->crud->entity_name; 83 | 84 | $this->data['id'] = $id; 85 | 86 | // load the view from /resources/views/vendor/backpack/crud/ if it exists, otherwise load the one in the package 87 | return view($this->crud->getEditView(), $this->data); 88 | } 89 | 90 | /** 91 | * Update the specified resource in the database. 92 | * 93 | * @return string 94 | */ 95 | public function nestedUpdate() 96 | { 97 | $this->crud->hasAccessOrFail('update'); 98 | 99 | // execute the FormRequest authorization and validation, if one is required 100 | $request = $this->crud->validateRequest(); 101 | 102 | // update the row in the db 103 | $item = $this->crud->update( 104 | $request->get($this->crud->model->getKeyName()), 105 | $this->crud->getStrippedSaveRequest() 106 | ); 107 | $this->data['entry'] = $this->crud->entry = $item; 108 | 109 | return $item->getKey(); 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /src/resources/views/crud/fields/nested_crud.blade.php: -------------------------------------------------------------------------------- 1 | @if ($crud->getCurrentOperation() === 'update') 2 | 3 | @php 4 | $routeBase = url($crud->route.'/'.$entry->getKey().'/'.$field['target']); 5 | $modelReflection = new \ReflectionClass($field['model']); 6 | $createModalId = 'createModal'.$modelReflection->getShortName(); 7 | $editModalId = 'editModal'.$modelReflection->getShortName(); 8 | @endphp 9 | 10 | @include('crud::fields.inc.wrapper_start') 11 | 12 | 13 | {{-- List view --}} 14 |
19 |
20 | 21 | @push('crud_fields_styles') 22 | {{-- This tag is the mark for applying styles from modal contents --}} 23 |
24 | @endpush 25 | 26 | @push('crud_fields_scripts') 27 | {{-- This tag is the mark for applying scripts from modal contents --}} 28 |
29 | 30 | {{-- Modal for create --}} 31 | 49 | 50 | {{-- Modal for edit --}} 51 | 68 | @endpush 69 | 70 | {{-- HINT --}} 71 | @if (isset($field['hint'])) 72 |

{!! $field['hint'] !!}

73 | @endif 74 | @include('crud::fields.inc.wrapper_end') 75 | 76 | {{-- ########################################## --}} 77 | {{-- Extra CSS and JS for this particular field --}} 78 | {{-- If a field type is shown multiple times on a form, the CSS and JS will only be loaded once --}} 79 | 80 | @push('crud_fields_scripts') 81 | 255 | @endpush 256 | {{-- End of Extra CSS and JS --}} 257 | {{-- ########################################## --}} 258 | 259 | @endif 260 | -------------------------------------------------------------------------------- /src/resources/views/nested_crud/buttons/create.blade.php: -------------------------------------------------------------------------------- 1 | @if ($crud->hasAccess('create')) 2 | @php 3 | $modelReflection = new \ReflectionClass($crud->model); 4 | @endphp 5 | 8 | @endif 9 | -------------------------------------------------------------------------------- /src/resources/views/nested_crud/buttons/delete.blade.php: -------------------------------------------------------------------------------- 1 | @if ($crud->hasAccess('delete')) 2 | {{ trans('backpack::crud.delete') }} 3 | @endif 4 | 5 | {{-- Button Javascript --}} 6 | {{-- - used right away in AJAX operations (ex: List) --}} 7 | {{-- - pushed to the end of the page, after jQuery is loaded, for non-AJAX operations (ex: Show) --}} 8 | @push('after_scripts') @if (request()->ajax()) @endpush @endif 9 | 91 | @if (!request()->ajax()) @endpush @endif -------------------------------------------------------------------------------- /src/resources/views/nested_crud/buttons/update.blade.php: -------------------------------------------------------------------------------- 1 | @if ($crud->hasAccess('update')) 2 | @php 3 | $modelReflection = new \ReflectionClass($crud->model); 4 | $modalId = '#editModal'.$modelReflection->getShortName(); 5 | $remoteUrl = url($crud->route.'/ajax/'.$entry->getKey().'/edit'); 6 | @endphp 7 | 8 | @if (!$crud->model->translationEnabled()) 9 | 10 | 11 | 21 | 22 | @else 23 | 24 | 25 |
26 | 36 | 39 | 54 |
55 | 56 | @endif 57 | @endif -------------------------------------------------------------------------------- /src/resources/views/nested_crud/inc/column_wrapper_attributes.blade.php: -------------------------------------------------------------------------------- 1 | @if (isset($column['wrapperAttributes'])) 2 | @if (!isset($column['wrapperAttributes']['class'])) 3 | class="form-group col-sm-12" 4 | @else 5 | class="{{ $column['wrapperAttributes']['class'] }}" 6 | @endif 7 | 8 | @php 9 | unset($column['wrapperAttributes']['class']); 10 | @endphp 11 | 12 | @foreach ($column['wrapperAttributes'] as $attribute => $value) 13 | @if (is_string($attribute)) 14 | {{ $attribute }}="{{ $value }}" 15 | @endif 16 | @endforeach 17 | @else 18 | class="form-group col-sm-12" 19 | @endif 20 | -------------------------------------------------------------------------------- /src/resources/views/nested_crud/modals/create.blade.php: -------------------------------------------------------------------------------- 1 | @extends('nested_crud::modals.layout') 2 | 3 | @section('header') 4 | 5 | @endsection 6 | 7 | @section('content') 8 |
9 | 10 | @include('crud::inc.grouped_errors') 11 | 12 | @if(view()->exists('vendor.backpack.crud.form_content')) 13 | @include('vendor.backpack.crud.form_content', [ 'fields' => $crud->fields(), 'action' => 'create' ]) 14 | @else 15 | @include('crud::form_content', [ 'fields' => $crud->fields(), 'action' => 'create' ]) 16 | @endif 17 |
18 | @endsection 19 | 20 | @section('footer') 21 |
22 | 23 | 24 |
25 | @endsection 26 | -------------------------------------------------------------------------------- /src/resources/views/nested_crud/modals/edit.blade.php: -------------------------------------------------------------------------------- 1 | @extends('nested_crud::modals.layout') 2 | 3 | @section('header') 4 | 5 | @endsection 6 | 7 | @section('content') 8 |
9 | 10 | @include('crud::inc.grouped_errors') 11 | 12 | @if(view()->exists('vendor.backpack.crud.form_content')) 13 | @include('vendor.backpack.crud.form_content', [ 'fields' => $crud->fields(), 'action' => 'edit' ]) 14 | @else 15 | @include('crud::form_content', [ 'fields' => $crud->fields(), 'action' => 'edit' ]) 16 | @endif 17 |
18 | @endsection 19 | 20 | @section('footer') 21 |
22 | 23 | 24 |
25 | @endsection 26 | -------------------------------------------------------------------------------- /src/resources/views/nested_crud/modals/layout.blade.php: -------------------------------------------------------------------------------- 1 |
2 | @stack('crud_fields_styles') 3 |
4 | 5 | 19 | 20 |
21 | @stack('crud_fields_scripts') 22 |
23 | -------------------------------------------------------------------------------- /src/resources/views/nested_crud/nested_grid_list.blade.php: -------------------------------------------------------------------------------- 1 |
2 | @forelse ($entries as $entry) 3 |
4 |
5 |
6 | @foreach ($crud->columns() as $column) 7 | 8 |
9 | 10 | 11 |
12 | @if (!isset($column['type'])) 13 | @include('crud::columns.text') 14 | @else 15 | @if(view()->exists('vendor.backpack.crud.columns.'.$column['type'])) 16 | @include('vendor.backpack.crud.columns.'.$column['type']) 17 | @else 18 | @if(view()->exists('crud::columns.'.$column['type'])) 19 | @include('crud::columns.'.$column['type']) 20 | @else 21 | @include('crud::columns.text') 22 | @endif 23 | @endif 24 | @endif 25 |
26 |
27 | 28 | @endforeach 29 | 30 | @if ($crud->buttons()->where('stack', 'line')->count()) 31 |
32 | 33 |
34 | @include('crud::inc.button_stack', ['stack' => 'line']) 35 |
36 |
37 | @endif 38 | 39 |
40 |
41 |
42 | @empty 43 |

{{ trans('backpack::crud.emptyTable') }}

44 | @endforelse 45 |
46 | 47 | {{-- Create button --}} 48 | @include('nested_crud::buttons.create') 49 | -------------------------------------------------------------------------------- /src/resources/views/nested_crud/nested_list.blade.php: -------------------------------------------------------------------------------- 1 | @php 2 | $hasActions = $crud->buttons()->where('stack', 'line')->count(); 3 | @endphp 4 | 5 | 6 | 7 | {{-- Table columns --}} 8 | @foreach ($crud->columns() as $column) 9 | 12 | @endforeach 13 | 14 | @if ($hasActions) 15 | 16 | @endif 17 | 18 | 19 | 20 | @forelse ($entries as $entry) 21 | 22 | @foreach ($crud->columns() as $column) 23 | 38 | @endforeach 39 | @if ($hasActions) 40 | 43 | @endif 44 | 45 | @empty 46 | 47 | 48 | 49 | @endforelse 50 | 51 | 52 | 53 | {{-- Table columns --}} 54 | @foreach ($crud->columns() as $column) 55 | 56 | @endforeach 57 | 58 | @if ($hasActions) 59 | 60 | @endif 61 | 62 | 63 |
10 | {!! $column['label'] !!} 11 | {{ trans('backpack::crud.actions') }}
24 | @if (!isset($column['type'])) 25 | @include('crud::columns.text') 26 | @else 27 | @if(view()->exists('vendor.backpack.crud.columns.'.$column['type'])) 28 | @include('vendor.backpack.crud.columns.'.$column['type']) 29 | @else 30 | @if(view()->exists('crud::columns.'.$column['type'])) 31 | @include('crud::columns.'.$column['type']) 32 | @else 33 | @include('crud::columns.text') 34 | @endif 35 | @endif 36 | @endif 37 | 41 | @include('crud::inc.button_stack', ['stack' => 'line']) 42 |
{{ trans('backpack::crud.emptyTable') }}
{!! $column['label'] !!}{{ trans('backpack::crud.actions') }}
64 | 65 | {{-- Create button --}} 66 | @include('nested_crud::buttons.create') 67 | --------------------------------------------------------------------------------