column('id', __('ID')); $grid->column('name', __('疫苗名称')); $grid->column('type', __('类别'))->editable('select',[1=>'一类',2=>'二类']); $grid->column('num', __('剩余库存')); $grid->column('num', __('已使用量')); $grid->column('num', __('今日预约')); $grid->column('price', __('价格'))->editable(); $grid->column('remark', __('备注'))->editable('textarea'); $grid->column('supplier', __('厂家')); // $grid->column('created_at', __('Created at')); // $grid->column('updated_at', __('Updated at')); $grid->filter(function ($fliter){ $fliter->equal('type','类别')->select([1=>'一类',2=>'二类']); // $fliter->equal('type','类别')->select([1=>'一类',2=>'二类']); }); $grid->actions(function ($actions) { // append一个操作 $actions->append('跳转'); // prepend一个操作 $actions->prepend(''); }); return $grid; } /** * Make a show builder. * * @param mixed $id * @return Show */ protected function detail($id) { $show = new Show(Vaccine::findOrFail($id)); $show->field('id', __('Id')); $show->field('type', __('Type')); $show->field('price', __('Price')); $show->field('name', __('Name')); $show->field('remark', __('Remark')); $show->field('supplier', __('Supplier')); $show->field('created_at', __('Created at')); $show->field('updated_at', __('Updated at')); return $show; } /** * Make a form builder. * * @return Form */ protected function form() { $form = new Form(new Vaccine()); $form->select('type', __('类型'))->options([1=>'一类',2=>'二类']); $form->number('price', __('价格')); $form->text('name', __('疫苗名称')); $form->textarea('remark', __('备注')); $form->text('supplier', __('厂家')); return $form; } }