type('select_from_array')->options(['resident' => 'Для резидентов', 'non_resident' => 'Для не резидентов'])->allows_null(false); CRUD::column('title'); CRUD::column('prices'); /** * 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(TarifRequest::class); CRUD::field('type')->type('select_from_array')->options(['resident' => 'Для резидентов', 'non_resident' => 'Для не резидентов'])->allows_null(false); CRUD::field('title'); CRUD::field('prices')->type('repeatable')->fields([ [ 'name' => 'price', 'type' => 'text', 'label' => 'Price', 'wrapper' => ['class' => 'form-group col-md-12'], ], ])->new_item_label("Add price"); /** * 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(); } protected function setupReorderOperation() { // define which model attribute will be shown on draggable elements $this->crud->set('reorder.label', 'title'); // define how deep the admin is allowed to nest the items // for infinite levels, set it to 0 $this->crud->set('reorder.max_level', 1); } }