disableActions(); $grid->disableCreateButton(); $grid->disableRowSelector(); $grid->disableFilterButton(); $grid->model()->where(function ($query) { return $query->whereHas('AgentProductItem', function ($query) { return $query->where('agent_id', Admin::user()->id); }); }); $grid->column('id')->sortable(); $grid->column('company_name'); $grid->column('address'); $grid->column('director'); $grid->column('contact_phone'); $grid->column('logo')->image('', 60, 60); $grid->column('avatar')->image('', 60, 60); $grid->column('license_pic')->image('', 60, 60); $grid->column('created_at', '入驻时间'); $grid->filter(function (Grid\Filter $filter) { $filter->panel(); $filter->equal('id'); }); }); } /** * Make a show builder. * * @param mixed $id * * @return Show */ protected function detail($id) { return Show::make($id, new Supplier(), function (Show $show) { $show->field('id'); /*$show->field('name'); $show->field('company_name'); $show->field('address'); $show->field('director'); $show->field('contact_phone'); $show->field('logo'); $show->field('avatar'); $show->field('license_pic'); $show->field('created_at'); $show->field('updated_at');*/ }); } /** * Make a form builder. * * @return Form */ protected function form() { return Form::make(new Supplier(), function (Form $form) { $form->display('id'); })->saving(function (Form $form) { $form->response()->error('操作禁止'); })->deleting(function (Form $form) { $form->response()->error('操作禁止'); }); } }