在 bootstrap.php
中
use Encore\Admin\Form;
Form::init(function (Form $form) {
$form->tools(function (Form\Tools $tools) {
// 去掉`列表`按钮
$tools->disableList();
// 去掉`删除`按钮
$tools->disableDelete();
// 去掉`查看`按钮
$tools->disableView();
});
$form->footer(function ($footer) {
// 去掉`查看`checkbox
$footer->disableViewCheck();
// 去掉`继续编辑`checkbox
$footer->disableEditingCheck();
// 去掉`继续创建`checkbox
$footer->disableCreatingCheck();
});
});
\Encore\Admin\Show::init(function (Show $show) {
$show->panel()
->tools(function ($tools) {
$tools->disableEdit();
$tools->disableDelete();
});
});
// 去掉导入
\Encore\Admin\Grid::init(function (\Encore\Admin\Grid $grid) {
$grid->disableExport();
});
// 去掉行选择
$grid->disableRowSelector();
// 去掉增加按钮
$grid->disableActions();
// 去掉操作按钮
$grid->disableActions();
//禁用导出数据按钮
$grid->disableExport();
$grid->tools(function ($tools) {
$tools->batch(function ($batch) {
// 去掉批量删除
$batch->disableDelete();
});
});
public $timestamps = false;
//
$grid->tools(function (Grid\Tools $tools) {
$tools->append($this->html());
});
// 当前文件的后面
public function html()
{
return <<<HTML
<a href="/admin/goods" class="btn btn-sm btn-success">返回</a>
HTML;
}
$show->panel()
->tools(function ($tools) {
$tools->disableEdit();
$tools->disableList();
$tools->disableDelete();
});
$grid->number('序号');
$grid->rows(function ($row, $number) {
$row->column('number', $number+1);
});
$form->display('column1');