addFields(); $this->crud->setValidation(StoreRequest::class); //otherwise, changes won't have effect \Cache::forget('spatie.permission.cache'); } public function setupUpdateOperation() { $this->addFields(); $this->crud->setValidation(UpdateRequest::class); //otherwise, changes won't have effect \Cache::forget('spatie.permission.cache'); } private function addFields() { $this->crud->addField([ 'name' => 'slug', 'label' => 'Slug', 'type' => 'text', ]); $this->crud->addField([ 'name' => 'name', 'label' => trans('backpack::permissionmanager.name'), 'type' => 'text', ]); if (config('backpack.permissionmanager.multiple_guards')) { $this->crud->addField([ 'name' => 'guard_name', 'label' => trans('backpack::permissionmanager.guard_type'), 'type' => 'select_from_array', 'options' => $this->getGuardTypes(), ]); } } /* * Get an array list of all available guard types * that have been defined in app/config/auth.php * * @return array **/ private function getGuardTypes() { $guards = config('auth.guards'); $returnable = []; foreach ($guards as $key => $details) { $returnable[$key] = $key; } return $returnable; } }