crud->addFilter([ 'name' => 'state', 'type' => 'dropdown', 'label' => 'State' ], [ 'new' => 'new', 'applied' => 'applied', 'approved' => 'approved', 'archived' => 'archived' ], function ($value) { // if the filter is active $this->crud->addClause('where', 'state', $value); }); } /** * Define what happens when the List operation is loaded. * * @see https://backpackforlaravel.com/docs/crud-operation-list-entries * @return void */ protected function setupListOperation() { $this->crud->setFromDb(); } /** * Define what happens when the Create operation is loaded. * * @see https://backpackforlaravel.com/docs/crud-operation-create * @return void */ protected function setupCreateOperation() { CRUD::setValidation(ApplicationRequest::class); $this->crud->addFields([ [ 'name' => 'account_id', 'type' => 'select', 'label' => 'Account', 'entity' => 'account', 'model' => "App\Models\Account", 'attribute' => 'legalization_number' ], [ 'name' => 'status', 'label' => 'Status', 'type' => 'checkbox' ], [ 'name' => 'state', 'label' => 'State', 'type' => 'select_from_array', 'options' => [ 'new' => 'new', 'applied' => 'applied', 'approved' => 'approved', 'archive' => 'archive' ] ] ]); } /** * Define what happens when the Update operation is loaded. * * @see https://backpackforlaravel.com/docs/crud-operation-update * @return void */ protected function setupUpdateOperation() { $this->setupCreateOperation(); $this->crud->setFromDb(); } }