You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
85 lines
2.2 KiB
85 lines
2.2 KiB
<?php
|
|
|
|
namespace App\AdminGuide\Controllers;
|
|
|
|
use App\AdminGuide\Repositories\Statement;
|
|
use App\Common\StatementType;
|
|
use App\Traits\DemandTraits;
|
|
use Dcat\Admin\Admin;
|
|
use Dcat\Admin\Form;
|
|
use Dcat\Admin\Grid;
|
|
use Dcat\Admin\Show;
|
|
use Dcat\Admin\Http\Controllers\AdminController;
|
|
|
|
class StatementController extends AdminController
|
|
{
|
|
/**
|
|
* Make a grid builder.
|
|
*
|
|
* @return Grid
|
|
*/
|
|
protected function grid()
|
|
{
|
|
return Grid::make(new Statement(), function (Grid $grid) {
|
|
$grid->model()->where([
|
|
'access_id'=> Admin::user()->id,
|
|
'access_type' => DemandTraits::$col[2]
|
|
]);
|
|
$grid->column('id')->sortable();
|
|
$grid->column('price');
|
|
$grid->column('type')->using(StatementType::array());
|
|
$grid->column('created_at');
|
|
$grid->column('updated_at')->sortable();
|
|
$grid->disableCreateButton();
|
|
$grid->disableActions();
|
|
$grid->disableRowSelector();
|
|
$grid->filter(function (Grid\Filter $filter) {
|
|
$filter->equal('id');
|
|
|
|
});
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Make a show builder.
|
|
*
|
|
* @param mixed $id
|
|
*
|
|
* @return Show
|
|
*/
|
|
protected function detail($id)
|
|
{
|
|
return Show::make($id, new Statement(), function (Show $show) {
|
|
$show->field('id');
|
|
$show->field('price');
|
|
$show->field('type');
|
|
$show->field('user_id');
|
|
$show->field('user_type');
|
|
$show->field('access_id');
|
|
$show->field('access_type');
|
|
$show->field('created_at');
|
|
$show->field('updated_at');
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Make a form builder.
|
|
*
|
|
* @return Form
|
|
*/
|
|
protected function form()
|
|
{
|
|
return Form::make(new Statement(), function (Form $form) {
|
|
$form->display('id');
|
|
$form->text('price');
|
|
$form->text('type');
|
|
$form->text('user_id');
|
|
$form->text('user_type');
|
|
$form->text('access_id');
|
|
$form->text('access_type');
|
|
|
|
$form->display('created_at');
|
|
$form->display('updated_at');
|
|
});
|
|
}
|
|
}
|