crud->setModel('App\Models\Folder'); $this->crud->setRoute(config('backpack.base.route_prefix') . '/folders'); $this->crud->setEntityNameStrings('Bukja', 'bukjalar'); $this->crud->orderBy('updated_at', 'DESC'); /* |-------------------------------------------------------------------------- | CrudPanel Configuration |-------------------------------------------------------------------------- */ // TODO: remove setFromDb() and manually define Fields and Columns //$this->crud->setFromDb(); $this->crud->addColumns([ ['label'=>'Bukjanyň ady','name'=>'title','type'=>'text'], ['label'=>'Mazmuny','name'=>'description','type'=>'ckeditor'], ]); $this->crud->addFields([ ['label'=>'Bukjanyň ady','name'=>'title','type'=>'text'], ['label'=>'Mazmuny','name'=>'description','type'=>'ckeditor'], //Select [ 'label'=>'Eýeçiligiň görnüşi', 'name'=>'property_id', 'type'=>'select', 'entity'=>'property', 'attribute'=>'title', 'model'=>'App\Models\PropertyType', 'option'=>(function($query){ return $query->orderBy('id','ASC')->get(); }) ], //Total Price ['label'=>'Umumy bahsy (Total price)','name'=>'total_price','type'=>'text'], ['label'=>'TV','name'=>'on_tv','type'=>'checkbox'], ['label'=>'Radio','name'=>'on_radio','type'=>'checkbox'], ['label'=>'Subtitle','name'=>'on_subtitle','type'=>'checkbox'], ['label'=>'Web','name'=>'on_web','type'=>'checkbox'], //checkBox ['label'=>'Ulanyjy wagt aralygyny saýlamaly.', 'name'=>'choice_time','type'=>'checkbox'], //Table [ 'Label'=>'Bukjanyň tablisasy', 'name'=>'folder_table', 'type'=>'table', 'entity_singular'=>'option', 'columns'=>[ 'time'=>'Wagt aralygy', 'price'=>'Bahasy', 'set_tv'=>'TV', 'set_radio'=>'Radio', 'set_sub'=>'Subtitle', 'set_web'=>'Web' ], 'min'=>'0' ], ]); // add asterisk for fields that are required in FolderRequest $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; } }