column('student_id')->using(config('map.students')); $grid->column('leave_type')->using(config('map.leave_type')); $grid->column('reason'); $grid->column('start_time'); $grid->column('end_time'); $grid->disableEditButton(); $grid->filter(function (Grid\Filter $filter) { $filter->panel(); $filter->date('created_at')->datetime()->width(4); $filter->equal('student_id','输入/选择学生')->select(config('map.students'))->width(4); }); }); } /** * Make a show builder. * * @param mixed $id * * @return Show */ protected function detail($id) { return Show::make($id, new Leave(), function (Show $show) { $show->row(function (Show\Row $show) { $show->field('content','请假详情') ->width(8) ->unescape() ->as(function () { $html = ''; $html .= '
'; $html .= '
请假人:' . config('map.students')[$this->student_id] . '
'; $html .= '
请假原因:' . $this->reason . '
'; $html .= '
请假类型:' . config('map.leave_type')[$this->leave_type] . '
'; $html .= '
开始时间:' . $this->start_time . '
'; $html .= '
结束时间:' . $this->end_time . '
'; $html .= '
'; return $html; }); }); }); } /** * Make a form builder. * * @return Form */ protected function form() { return Form::make(new Leave(), function (Form $form) { $form->display('id'); $form->text('student_id'); $form->text('reason'); $form->text('start_time'); $form->text('end_time'); $form->display('created_at'); $form->display('updated_at'); }); } }