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.
78 lines
1.9 KiB
78 lines
1.9 KiB
<?php
|
|
|
|
namespace App\AdminSupplier\Controllers;
|
|
|
|
use App\Admin\Repositories\ProductExportLog;
|
|
use Dcat\Admin\Form;
|
|
use Dcat\Admin\Grid;
|
|
use Dcat\Admin\Show;
|
|
use Dcat\Admin\Http\Controllers\AdminController;
|
|
|
|
class ProductExportLogController extends AdminController
|
|
{
|
|
/**
|
|
* Make a grid builder.
|
|
*
|
|
* @return Grid
|
|
*/
|
|
protected function grid()
|
|
{
|
|
return Grid::make(new ProductExportLog(), function (Grid $grid) {
|
|
$grid->disableActions();
|
|
$grid->disableCreateButton();
|
|
$grid->disableBatchActions();
|
|
$grid->disableRowSelector();
|
|
|
|
$grid->model()->where('supplier_id', \Admin::user()->id)->orderByDesc('id');
|
|
|
|
$grid->column('id')->sortable();
|
|
$grid->column('filename')->downloadable();
|
|
$grid->column('created_at');
|
|
|
|
$grid->filter(function (Grid\Filter $filter) {
|
|
$filter->equal('id')->width(2);
|
|
});
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Make a show builder.
|
|
*
|
|
* @param mixed $id
|
|
*
|
|
* @return Show
|
|
*/
|
|
protected function detail($id)
|
|
{
|
|
return Show::make($id, new ProductExportLog(), function (Show $show) {
|
|
$show->disableDeleteButton();
|
|
$show->disableEditButton();
|
|
|
|
$show->field('id');
|
|
$show->field('filename')->file();
|
|
$show->field('created_at');
|
|
$show->field('updated_at');
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Make a form builder.
|
|
*
|
|
* @return Form
|
|
*/
|
|
protected function form()
|
|
{
|
|
return Form::make(new ProductExportLog(), function (Form $form) {
|
|
$form->display('id');
|
|
$form->text('supplier_id');
|
|
$form->text('filename');
|
|
|
|
$form->display('created_at');
|
|
$form->display('updated_at');
|
|
})->saving(function (Form $form) {
|
|
return $form->response()->error('操作禁止');
|
|
})->deleting(function (Form $form) {
|
|
return $form->response()->error('操作禁止');
|
|
});
|
|
}
|
|
}
|