header('创业项目') ->description(' ') ->body($this->grid()); } /** * Show interface. * * @param mixed $id * @param Content $content * @return Content */ public function show($id, Content $content) { return $content ->header('Detail') ->description('description') ->body($this->detail($id)); } /** * Edit interface. * * @param mixed $id * @param Content $content * @return Content */ public function edit($id, Content $content) { return $content ->header('Edit') ->description('description') ->body($this->form()->edit($id)); } /** * Create interface. * * @param Content $content * @return Content */ public function create(Content $content) { return $content ->header('Create') ->description('description') ->body($this->form()); } /** * Make a grid builder. * * @return Grid */ protected function grid() { $grid = new Grid(new membersProject); $grid->model()->orderBy('id', 'desc'); $grid->project_title('创业项目'); $grid->project_intro('项目介绍'); $grid->link_man('联系人'); $grid->link_phone('联系电话'); $grid->link_email('联系邮箱'); $grid->actions(function ($actions) { $actions->disableDelete();//屏蔽删除按钮 $actions->disableEdit();//屏蔽编辑按钮 $actions->disableView(false);//屏蔽查看按钮 }); $grid->filter(function ($filter) { // $filter->equal('id', 'ID'); $filter->like('project_title', '标题'); $filter->like('link_man', '联系人'); $filter->like('link_phone', '联系电话'); $date3 = date('Y-m-d', strtotime("-3 day")); $date7 = date('Y-m-d', strtotime("-7 day")); $date30 = date("Y-m-d", strtotime("-1 month")); $date180 = date("Y-m-d", strtotime("-6 month")); $date360 = date("Y-m-d", strtotime("-1 year")); $date_option = array( '' => '不限', $date3 => '三天内', $date7 => '一周内', $date30 => '一月内', $date180 => '半年内', $date360 => '一年内', ); $filter->where(function ($query) { $query->where('created_at', '>=', "{$this->input}"); }, '添加时间', 'created_at')->radio($date_option); }); return $grid; } /** * Make a show builder. * * @param mixed $id * @return Show */ protected function detail($id) { $show = new Show(membersProject::findOrFail($id)); $show->link_man('联系人'); $show->link_phone('联系电话'); $show->link_email('联系邮箱'); $show->link_address('联系地址'); $show->project_title('创业项目'); $show->project_intro('项目介绍'); $show->project_info('创业情况'); $show->project_help('希望获得的帮助'); $show->uid('用户id'); $show->created_at('创建时间'); $show->updated_at('修改时间'); return $show; } /** * Make a form builder. * * @return Form */ protected function form() { $form = new Form(new membersProject); $form->display('ID'); $form->display('Created at'); $form->display('Updated at'); return $form; } }