crud->setModel('App\Models\Subscription'); $this->crud->setRoute(config('backpack.base.route_prefix') . '/subscription'); $this->crud->setEntityNameStrings('subscription', 'subscriptions'); $this->crud->orderBy('updated_at', 'DESC'); /* |-------------------------------------------------------------------------- | CrudPanel Configuration |-------------------------------------------------------------------------- */ // TODO: remove setFromDb() and manually define Fields and Columns //$this->crud->setFromDb(); $this->crud->addFields([ [ 'name' => 'title', 'label' => 'Ady', 'type' => 'text' ], [ 'name' => 'duration', 'label' => 'Gun sany', 'type' => 'number' ], [ // Table 'name' => 'description', 'label' => 'Descriptions', 'type' => 'table', 'entity_singular' => 'description', // used on the "Add X" button 'columns' => [ 'desc' => 'Text' ] ], [ 'name' => 'price', 'label' => 'Tolegi', 'type' => 'number' ] ]); $this->crud->addColumns([ [ 'name' => 'title', 'label' => 'Ady', 'type' => 'text' ], [ 'name' => 'duration', 'label' => 'Gun sany', 'type' => 'number' ], [ 'name' => 'price', 'label' => 'Tolegi', 'type' => 'number' ] ]); // add asterisk for fields that are required in SubscriptionRequest $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; } }