authorize('browse', Actor::class); CRUD::addColumn(['name' => 'name', 'label' => 'Tên', 'type' => 'text']); CRUD::addColumn(['name' => 'slug', 'label' => 'Đường dẫn tĩnh', 'type' => 'text']); CRUD::addColumn(['name' => 'gender', 'label' => 'Giới tính', 'type' => 'text']); CRUD::addColumn(['name' => 'image', 'label' => 'Ảnh', 'type' => 'image']); } /** * Define what happens when the Create operation is loaded. * * @see https://backpackforlaravel.com/docs/crud-operation-create * @return void */ protected function setupCreateOperation() { $this->authorize('create', Actor::class); CRUD::setValidation(ActorRequest::class); CRUD::addField(['name' => 'name', 'label' => 'Tên', 'type' => 'text']); CRUD::addField(['name' => 'slug', 'label' => 'Đường dẫn tĩnh', 'type' => 'text']); CRUD::addField(['name' => 'image', 'label' => 'Ảnh', 'type' => 'upload']); CRUD::addField([ 'name' => 'gender', 'label' => "Giới tính", 'type' => 'select_from_array', 'options' => ['male' => 'Nam', 'female' => 'Nữ', 'other' => 'Khác'], 'allows_null' => false, 'default' => 'one', ],); } /** * Define what happens when the Update operation is loaded. * * @see https://backpackforlaravel.com/docs/crud-operation-update * @return void */ protected function setupUpdateOperation() { $this->authorize('update', $this->crud->getEntryWithLocale($this->crud->getCurrentEntryId())); $this->setupCreateOperation(); } protected function setupDeleteOperation() { $this->authorize('delete', $this->crud->model); } }