hasPermissionTo('ticket-category'))){ $this->crud->denyAccess(['delete', 'update']); } CRUD::setModel(\App\Models\Category::class); CRUD::setRoute(config('backpack.base.route_prefix') . '/category'); CRUD::setEntityNameStrings('category', 'categories'); } /** * Define what happens when the List operation is loaded. * * @see https://backpackforlaravel.com/docs/crud-operation-list-entries * @return void */ protected function setupListOperation() { CRUD::column('name'); /** * Columns can be defined using the fluent syntax or array syntax: * - CRUD::column('price')->type('number'); * - CRUD::addColumn(['name' => 'price', '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(CategoryRequest::class); CRUD::field('name'); /** * Fields can be defined using the fluent syntax or array syntax: * - CRUD::field('price')->type('number'); * - CRUD::addField(['name' => '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 store() { $response = $this->traitStore(); Permission::create([ 'name' => "ticket-category-" . $this->crud->getRequest()->request->get('name'), 'guard_name' => 'web' ]); return $response; } }