| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- <?php
- namespace App\Admin\Controllers;
- use App\Models\TeachPlan;
- use Dcat\Admin\Form;
- use Dcat\Admin\Grid;
- use Dcat\Admin\Show;
- use Dcat\Admin\Http\Controllers\AdminController;
- class TeachPlanController extends AdminController
- {
- /**
- * Make a grid builder.
- *
- * @return Grid
- */
- protected function grid()
- {
- return Grid::make(new TeachPlan(), function (Grid $grid) {
- $grid->column('title');
- $grid->column('time');
- $grid->column('plan_type')->using(config('map.plan_type'));
- $grid->column('create_user_id')->using(config('map.teachers'));
- $grid->column('content');
- $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 TeachPlan(), function (Show $show) {
- $show->field('title');
- $show->field('time');
- $show->field('plan_type');
- $show->field('create_user_id');
- $show->field('content');
- $show->field('photos');
- $show->field('created_at');
- $show->field('updated_at');
- });
- }
- /**
- * Make a form builder.
- *
- * @return Form
- */
- protected function form()
- {
- return Form::make(new TeachPlan(), function (Form $form) {
- $form->select('plan_type')->options(config('map.plan_type'));
- $form->text('title');
- $form->textarea('content');
- $form->multipleImage('photos','上传照片')->saveAsJson();
- $form->file('pdf_file','点击上传文件')->help('上传格式为PDF,且大小不超过100MB');
- });
- }
- }
|