Created
January 9, 2018 23:16
-
-
Save chriscalip/9d7a3018115cbef00f45b0d0909fe57c to your computer and use it in GitHub Desktop.
Explaining the idea of Is it possible for Backpack\CRUD\app\Http\Controllers\CrudController on method setup to change the underlying query? eg. /admin/vocabulary/{vid}/overview Overview CRUD of terms that are children of vocabulary {vid}?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace App\Http\Controllers\Admin; | |
| use Backpack\CRUD\app\Http\Controllers\CrudController; | |
| use App\Http\Requests\VocabularyCrudRequest as StoreRequest; | |
| use App\Http\Requests\VocabularyCrudRequest as UpdateRequest; | |
| class VocabularyCrudController extends CrudController { | |
| public function setup() { | |
| $this->crud->setModel('App\Vocabulary'); | |
| $this->crud->setRoute('admin/vocabulary'); | |
| $this->crud->setEntityNameStrings('vocabulary', 'vocabularies'); | |
| $this->crud->setColumns(['name']); | |
| $this->crud->addField([ | |
| 'name' => 'name', | |
| 'label' => 'Vocabulary', | |
| 'type' => 'text', | |
| 'placeholder' => 'Your title here', | |
| ]); | |
| $this->crud->addField([ | |
| 'name' => 'description', | |
| 'label' => 'Description', | |
| 'type' => 'ckeditor', | |
| 'placeholder' => 'Your textarea text here', | |
| ]); | |
| $this->crud->addButtonFromView('line', 'listofterms', 'listofterms', 'beginning'); | |
| } | |
| public function store(StoreRequest $request) | |
| { | |
| return parent::storeCrud(); | |
| } | |
| public function update(UpdateRequest $request) | |
| { | |
| return parent::updateCrud(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment