12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- <?php
- namespace App\Admin\Controllers;
- use App\Models\DiarySleepLevel;
- use Encore\Admin\Controllers\AdminController;
- use Encore\Admin\Form;
- use Encore\Admin\Grid;
- use Encore\Admin\Show;
- class DiarySleepLevelController extends AdminController
- {
- /**
- * Title for current resource.
- *
- * @var string
- */
- protected $title = '睡眠等级';
- /**
- * Make a grid builder.
- *
- * @return Grid
- */
- protected function grid()
- {
- $grid = new Grid(new DiarySleepLevel());
- $grid->column('id', __('Id'));
- $grid->column('name', __('级别名'));
- $grid->column('color', __('颜色'));
- $grid->column('rank', __('排序 越大越靠前'));
- $grid->column('created_at', __('创建时间'));
- $grid->column('updated_at', __('更新时间'));
- return $grid;
- }
- /**
- * Make a show builder.
- *
- * @param mixed $id
- * @return Show
- */
- protected function detail($id)
- {
- $show = new Show(DiarySleepLevel::findOrFail($id));
- $show->field('id', __('Id'));
- $show->field('name', __('Name'));
- $show->field('pic', __('Pic'));
- $show->field('hover_pic', __('Hover pic'));
- $show->field('color', __('Color'));
- $show->field('rank', __('Rank'));
- $show->field('created_at', __('Created at'));
- $show->field('updated_at', __('Updated at'));
- $show->field('deleted_at', __('Deleted at'));
- return $show;
- }
- /**
- * Make a form builder.
- *
- * @return Form
- */
- protected function form()
- {
- $form = new Form(new DiarySleepLevel());
- $form->text('name', __('级别名'));
- $form->image('pic', __('未选中的图片'));
- $form->image('hover_pic', __('选中时的图片'));
- $form->color('color', __('文字颜色'));
- $form->number('rank', __('排序 越大越靠前'));
- return $form;
- }
- }
|