column('id')->sortable(); $helper = new GridHelper($grid,$this); $grid->column('title'); $grid->column('desc'); $grid->column('status')->switch(); $grid->column('content_title'); $grid->column('cate'); $helper->columnUsingVk('drive',NoticeDriver::getValueDescription()); $helper->columnAtd('created_at'); $grid->filter(function (Grid\Filter $filter) { $filterHelp= new FilterHelper($filter,$this); $filterHelp->equalSelectVk('cate',NoticeCate::getKv()); $filterHelp->equalSelectVk('drive',NoticeDriver::getValueDescription()); }); }); } /** * Make a show builder. * * @param mixed $id * * @return Show */ protected function detail($id) { return Show::make($id, new NoticeTemplete(), function (Show $show) { $helper = new ShowHelper($show,$this); $show->field('id'); $show->field('title'); $show->field('status'); $show->field('content_title'); $show->field('drive'); // $show->field('drive')->using(NoticeType::driverOptions2()); $show->field('cate'); $show->field('content')->unescape()->render(); $show->field('created_at'); $show->field('updated_at'); }); } /** * Make a form builder. * * @return Form */ protected function form() { return Form::make(new NoticeTemplete(), function (Form $form) { $form->display('id'); $form->display('title'); $form->switch('status'); $form->display('drive'); $form->display('cate'); // if($form->isEditing()){ if($form->model()->drive =='sms'){ $form->textarea('content'); }else{ $form->textarea('content_title'); $form->editor('content', '内容'); } } $form->display('created_at'); $form->display('updated_at'); }); } }