type('number'); */ } /** * Define what happens when the Create operation is loaded. * * @see https://backpackforlaravel.com/docs/crud-operation-create * @return void */ protected function setupCreateOperation() { CRUD::setValidation(EventRegistrationInfoRequest::class); CRUD::setFromDb(); // set fields from db columns. /** * Fields can be defined using the fluent syntax: * - CRUD::field('price')->type('number'); */ } /** * Define what happens when the Update operation is loaded. * * @see https://backpackforlaravel.com/docs/crud-operation-update * @return void */ protected function setupUpdateOperation() { $this->setupCreateOperation(); } public function update() { // do something before validation, before save, before everything $response = $this->traitUpdate(); $entry = $this->crud->getCurrentEntry(); // do something after save Cache::forget('event-info-cache-'.$entry->id); //Cache::put('event-info-cache-'.$entry->id, null, 0); //Cache::flush(); $eventInfo = Cache::get('event-info-cache-'.$entry->id, function () use ($entry) { return ['enable'=>$entry->enable,'limit' => $entry->limit, 'start_at' => $entry->event_start_date, 'end_at' => $entry->event_end_date ]; }); return $response; } }