| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- <?php
- namespace App\Admin\Controllers;
- use App\Models\Babysitting;
- use Dcat\Admin\Form;
- use Dcat\Admin\Grid;
- use Dcat\Admin\Show;
- use Dcat\Admin\Http\Controllers\AdminController;
- class BabysittingController extends AdminController
- {
- /**
- * Make a grid builder.
- *
- * @return Grid
- */
- protected function grid()
- {
- return Grid::make(new Babysitting(), function (Grid $grid) {
- $grid->column('student_id')->using(config('map.students'));
- $grid->column('look_time');
- $grid->column('looker')->using(config('map.teachers'));
- $grid->column('is_publish')->using([0=>'否',1=>'是']);
- $grid->disableViewButton();
- $grid->filter(function (Grid\Filter $filter) {
- $filter->panel();
- $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 Babysitting(), function (Show $show) {
- $show->field('id');
- $show->field('look_time');
- $show->field('is_share_to_parents');
- $show->field('looker');
- $show->field('title');
- $show->field('student_id');
- $show->field('desc');
- $show->field('photos');
- $show->field('videos');
- $show->field('choose_ability');
- $show->column('is_publish');
- $show->field('effective_learn_characteristics');
- $show->field('next_teach_activity_plan');
- $show->field('look_bg');
- $show->field('created_at');
- $show->field('updated_at');
- });
- }
- /**
- * Make a form builder.
- *
- * @return Form
- */
- protected function form()
- {
- return Form::make(new Babysitting(), function (Form $form) {
- $form->row(function (Form\Row $row) {
- $row->width(2)->datetime('look_time')->required();
- $row->width(1)->switch('is_share_to_parents');
- $row->width(1)->select('looker')->options(config('map.teachers'))->disable();
- });
- $form->row(function (Form\Row $row) {
- $row->text('title')->placeholder('请输入标题')->required();
- });
- $form->row(function (Form\Row $row) {
- $row->select('student_id')->options(config('map.students'))->placeholder('请选择学生')->required();
- });
- $form->row(function (Form\Row $row) {
- $row->textarea('desc')->placeholder('请输入描述')->required();
- });
- $form->row(function (Form\Row $row) use($form) {
- $row->width(3)->multipleImage('photos');
- $row->width(3)->file('videos');
- // $row->radio('type')
- // ->when(1,function(Form $form){
-
- // })
- // ->when(2,function(Form $form){
-
- // })
- // ->options([1=>'上传图片',2=>'上传视频'])
- // ->default(1);
- });
- $form->row(function (Form\Row $row) {
- $row->select('choose_ability')->options(config('map.students'))->placeholder('请选择能力')->required();
- });
- $form->row(function (Form\Row $row) {
- $row->select('effective_learn_characteristics')->options(config('map.students'))->placeholder('请选有效学习特征')->required();
- });
- $form->text('is_publish');
-
- $form->row(function (Form\Row $row) {
- $row->textarea('next_teach_activity_plan')->placeholder('请输入下一步教学活动安排')->required();
- });
- $form->row(function (Form\Row $row) {
- $row->textarea('look_bg')->placeholder('请输入观察背景')->required();
- });
- $form->disableViewButton();
- });
- }
- }
|