crud->setModel('App\Models\Slider'); $this->crud->setRoute(config('backpack.base.route_prefix') . '/slider'); $this->crud->setEntityNameStrings('slider', 'sliders'); $this->crud->orderBy('updated_at', 'DESC'); /* |-------------------------------------------------------------------------- | CrudPanel Configuration |-------------------------------------------------------------------------- */ // TODO: remove setFromDb() and manually define Fields and Columns //$this->crud->setFromDb(); $this->crud->addColumns([ ['name' => 'page_id', 'type' => 'select', 'entity' => 'page', 'attribute' =>'title', 'model' => 'App\Models\Page', 'lable'=>'Page'], ['name' => 'home','type' => 'boolean', 'lable' => 'Home'], ['name' => 'url','type' => 'text', 'lable' => 'Url'], ['name' => 'img_url','type' => 'text', 'lable' => 'Image'], ['name' => 'alt','type' => 'text', 'lable' => 'Alt'], ]); $this->crud->addFields([ ['name' => 'page_id', 'type' => 'select', 'entity' => 'page', 'attribute' =>'title', 'model' => 'App\Models\Page', 'lable'=>'Page'], ['name' => 'url','type' => 'text', 'lable' => 'Url'], ['name' => 'img_url','type' => 'browse', 'lable' => 'Image'], ['name' => 'alt','type' => 'text', 'lable' => 'Alt'], ['name' => 'home','type' => 'checkbox', 'lable' => 'Home'], ]); // add asterisk for fields that are required in SliderRequest $this->crud->setRequiredFields(StoreRequest::class, 'create'); $this->crud->setRequiredFields(UpdateRequest::class, 'edit'); } public function store(StoreRequest $request) { // your additional operations before save here $redirect_location = parent::storeCrud($request); // your additional operations after save here // use $this->data['entry'] or $this->crud->entry return $redirect_location; } public function update(UpdateRequest $request) { // your additional operations before save here $redirect_location = parent::updateCrud($request); // your additional operations after save here // use $this->data['entry'] or $this->crud->entry return $redirect_location; } }