| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- <?php
- namespace App\Admin\Controllers;
- use App\Models\Leave;
- use Dcat\Admin\Form;
- use Dcat\Admin\Grid;
- use Dcat\Admin\Show;
- use Dcat\Admin\Http\Controllers\AdminController;
- class LeaveController extends AdminController
- {
- /**
- * Make a grid builder.
- *
- * @return Grid
- */
- protected function grid()
- {
- return Grid::make(new Leave(), function (Grid $grid) {
-
- $grid->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->filter(function (Grid\Filter $filter) {
- $filter->equal('id');
-
- });
- });
- }
- /**
- * Make a show builder.
- *
- * @param mixed $id
- *
- * @return Show
- */
- protected function detail($id)
- {
- return Show::make($id, new Leave(), function (Show $show) {
- $show->field('id');
- $show->field('student_id');
- $show->field('reason');
- $show->field('start_time');
- $show->field('end_time');
- $show->field('created_at');
- $show->field('updated_at');
- });
- }
- /**
- * 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');
- });
- }
- }
|