| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- <?php
- namespace App\Admin\Controllers;
- use App\Models\Notice;
- use Dcat\Admin\Form;
- use Dcat\Admin\Grid;
- use Dcat\Admin\Show;
- use Dcat\Admin\Http\Controllers\AdminController;
- class NoticeController extends AdminController
- {
- /**
- * Make a grid builder.
- *
- * @return Grid
- */
- protected function grid()
- {
- return Grid::make(new Notice(), function (Grid $grid) {
- $grid->column('teacher_id')->using(config('map.teachers'));
- $grid->column('content');
- $grid->column('created_at');
- $grid->column('status')->using(config('map.notice_status'));
- $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 Notice(), function (Show $show) {
- $show->row(function (Show\Row $show) {
- $show->width(12)->field('content');
- $show->width(12)->field('teacher_id','通知对象')->using(config('map.teachers'));
- });
- // $show->field('teacher_id');
- // $show->field('content');
- // $show->field('created_at');
- // $show->field('status');d
- // $show->field('updated_at');
- });
- }
- /**
- * Make a form builder.
- *
- * @return Form
- */
- protected function form()
- {
- return Form::make(new Notice(), function (Form $form) {
-
- $form->row(function (Form\Row $form) {
- $form->width(12)->text('title');
- $form->width(12)->textarea('content');
- $form->multipleImage('photos','上传照片')->saveAsJson();
- $form->file('pdf_file','点击上传文件')->help('上传格式为PDF,且大小不超过100MB');
- });
- //$form->disableViewButton();
- // $form->text('teacher_id');
- // $form->text('status');
- // $form->text('desc');
- });
- }
- }
|