birzha-legalizasia/app/Http/Controllers/Admin/ResolutionbasisCrudControll...

108 lines
3.5 KiB
PHP
Raw Normal View History

2022-11-19 11:28:38 +00:00
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Requests\ResolutionbasisRequest;
use Backpack\CRUD\app\Http\Controllers\CrudController;
use Backpack\CRUD\app\Library\CrudPanel\CrudPanelFacade as CRUD;
/**
* Class ResolutionbasisCrudController
* @package App\Http\Controllers\Admin
* @property-read \Backpack\CRUD\app\Library\CrudPanel\CrudPanel $crud
*/
class ResolutionbasisCrudController extends CrudController
{
use \Backpack\CRUD\app\Http\Controllers\Operations\ListOperation;
use \Backpack\CRUD\app\Http\Controllers\Operations\UpdateOperation;
use \Backpack\CRUD\app\Http\Controllers\Operations\DeleteOperation;
use \Backpack\CRUD\app\Http\Controllers\Operations\ShowOperation;
/**
* Configure the CrudPanel object. Apply settings to all operations.
2022-11-22 10:29:40 +00:00
*
2022-11-19 11:28:38 +00:00
* @return void
*/
public function setup()
{
CRUD::setModel(\App\Models\Resolutionbasis::class);
CRUD::setRoute(config('backpack.base.route_prefix') . '/resolutionbasis');
CRUD::setEntityNameStrings(trans('app.resolution.resolutionbasis'), trans('app.resolution.resolutionbases'));
2022-11-19 11:28:38 +00:00
}
/**
* Define what happens when the List operation is loaded.
2022-11-22 10:29:40 +00:00
*
2022-11-19 11:28:38 +00:00
* @see https://backpackforlaravel.com/docs/crud-operation-list-entries
* @return void
*/
protected function setupListOperation()
{
2022-11-22 10:29:40 +00:00
$this->crud->addColumns([
[
'name' => 'contract_id',
'type' => 'select',
'label' => trans('app.contract.title'),
'entity' => 'department',
'attribute' => 'InputNumber',
'model' => 'App\Models\Contract'
2022-11-22 10:29:40 +00:00
],
2022-11-22 21:42:32 +00:00
[
'name' => 'department_id',
'type' => 'select',
'label' => trans('app.resolution.department'),
2022-11-22 21:42:32 +00:00
'entity' => 'department',
'attribute' => 'title',
'model' => 'App\Models\Department'
],
[
'name' => 'resolution_id',
'type' => 'select',
'label' => trans('app.resolution.resolution'),
2022-11-22 21:42:32 +00:00
'entity' => 'resolution',
'attribute' => 'title',
'model' => 'App\Models\Resolution'
],
2022-11-22 10:29:40 +00:00
[
'name' => 'resolutionbasis',
'type' => 'text',
'label' => trans('app.resolution.resolutionbasis')
2022-11-22 10:29:40 +00:00
]
]);
2022-11-19 11:28:38 +00:00
/**
* Columns can be defined using the fluent syntax or array syntax:
* - CRUD::column('price')->type('number');
2022-11-22 10:29:40 +00:00
* - CRUD::addColumn(['name' => 'price', 'type' => 'number']);
2022-11-19 11:28:38 +00:00
*/
}
/**
* Define what happens when the Create operation is loaded.
2022-11-22 10:29:40 +00:00
*
2022-11-19 11:28:38 +00:00
* @see https://backpackforlaravel.com/docs/crud-operation-create
* @return void
*/
protected function setupCreateOperation()
{
CRUD::setValidation(ResolutionbasisRequest::class);
/**
* Fields can be defined using the fluent syntax or array syntax:
* - CRUD::field('price')->type('number');
2022-11-22 10:29:40 +00:00
* - CRUD::addField(['name' => 'price', 'type' => 'number']));
2022-11-19 11:28:38 +00:00
*/
}
/**
* Define what happens when the Update operation is loaded.
2022-11-22 10:29:40 +00:00
*
2022-11-19 11:28:38 +00:00
* @see https://backpackforlaravel.com/docs/crud-operation-update
* @return void
*/
protected function setupUpdateOperation()
{
$this->setupCreateOperation();
}
}