109 lines
3.3 KiB
PHP
109 lines
3.3 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Admin;
|
|
|
|
use App\Http\Requests\TradingRequest;
|
|
use Backpack\CRUD\app\Http\Controllers\CrudController;
|
|
use Backpack\CRUD\app\Library\CrudPanel\CrudPanelFacade as CRUD;
|
|
|
|
/**
|
|
* Class TradingCrudController
|
|
* @package App\Http\Controllers\Admin
|
|
* @property-read \Backpack\CRUD\app\Library\CrudPanel\CrudPanel $crud
|
|
*/
|
|
class TradingCrudController extends CrudController
|
|
{
|
|
use \Backpack\CRUD\app\Http\Controllers\Operations\ListOperation;
|
|
use \Backpack\CRUD\app\Http\Controllers\Operations\CreateOperation;
|
|
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\Trading::class);
|
|
CRUD::setRoute(config('backpack.base.route_prefix') . '/trading');
|
|
CRUD::setEntityNameStrings('trading', 'tradings');
|
|
}
|
|
|
|
/**
|
|
* Define what happens when the List operation is loaded.
|
|
*
|
|
* @see https://backpackforlaravel.com/docs/crud-operation-list-entries
|
|
* @return void
|
|
*/
|
|
protected function setupListOperation()
|
|
{
|
|
CRUD::column('group_id');
|
|
CRUD::column('subgroup_id');
|
|
CRUD::column('category_id');
|
|
// CRUD::column('type');
|
|
CRUD::column('title');
|
|
CRUD::column('price');
|
|
CRUD::column('unit');
|
|
CRUD::column('amount');
|
|
CRUD::column('currency');
|
|
CRUD::column('seller_country');
|
|
CRUD::column('buyer_country');
|
|
CRUD::column('point');
|
|
CRUD::column('is_line');
|
|
CRUD::column('locale');
|
|
CRUD::column('created_at');
|
|
CRUD::column('updated_at');
|
|
|
|
/**
|
|
* 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(TradingRequest::class);
|
|
|
|
CRUD::field('group_id');
|
|
CRUD::field('subgroup_id');
|
|
CRUD::field('category_id');
|
|
CRUD::field('type');
|
|
CRUD::field('title');
|
|
CRUD::field('unit');
|
|
CRUD::field('amount');
|
|
CRUD::field('currency');
|
|
CRUD::field('seller_country');
|
|
CRUD::field('buyer_country');
|
|
CRUD::field('point');
|
|
CRUD::field('price');
|
|
CRUD::field('is_line');
|
|
CRUD::field('locale');
|
|
|
|
/**
|
|
* 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();
|
|
}
|
|
}
|