117 lines
3.9 KiB
PHP
117 lines
3.9 KiB
PHP
<?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.
|
|
*
|
|
* @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'));
|
|
}
|
|
|
|
/**
|
|
* 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->enableExportButtons();
|
|
$this->crud->addColumns([
|
|
[
|
|
'name' => 'contract_id',
|
|
'type' => 'select',
|
|
'label' => trans('app.contract.title'),
|
|
'entity' => 'contract',
|
|
'attribute' => 'InputNumber',
|
|
'model' => 'App\Models\Contract',
|
|
'searchLogic' => function ($query, $column, $searchTerm) {
|
|
$query->whereHas('contract', function ($q) use ($column, $searchTerm) {
|
|
$q->where('InputNumber', 'like', '%'.$searchTerm.'%');
|
|
});
|
|
}
|
|
],
|
|
[
|
|
'name' => 'department_id',
|
|
'type' => 'select',
|
|
'label' => trans('app.resolution.department'),
|
|
'entity' => 'department',
|
|
'attribute' => 'title',
|
|
'model' => 'App\Models\Department',
|
|
'searchLogic' => false
|
|
],
|
|
[
|
|
'name' => 'resolution_id',
|
|
'type' => 'select',
|
|
'label' => trans('app.resolution.resolution'),
|
|
'entity' => 'resolution',
|
|
'attribute' => 'title',
|
|
'model' => 'App\Models\Resolution',
|
|
'searchLogic' => false
|
|
],
|
|
[
|
|
'name' => 'resolutionbasis',
|
|
'type' => 'text',
|
|
'label' => trans('app.resolution.resolutionbasis'),
|
|
'searchLogic' => false
|
|
]
|
|
]);
|
|
|
|
/**
|
|
* 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(ResolutionbasisRequest::class);
|
|
|
|
/**
|
|
* 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();
|
|
}
|
|
}
|