123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- <?php
- namespace App\Admin\Controllers;
- use App\Models\SysConfig;
- use Encore\Admin\Controllers\AdminController;
- use Encore\Admin\Form;
- use Encore\Admin\Grid;
- use Encore\Admin\Show;
- class SysConfigController extends AdminController
- {
- /**
- * Title for current resource.
- *
- * @var string
- */
- protected $title = '系统基本信息';
- /**
- * Make a grid builder.
- *
- * @return Grid
- */
- protected function grid()
- {
- $grid = new Grid(new SysConfig());
- $grid->column('id', __('Id'));
- $grid->column('name', __('系统名'));
- $grid->column('hotline_number', __('咨询电话'));
- $grid->column('hotline_number_pic', __('热线图片'))->lightbox([
- 'width' => 100
- ]);
- $grid->column('hot_search', __('热搜索关键词'));
- return $grid;
- }
- /**
- * Make a show builder.
- *
- * @param mixed $id
- * @return Show
- */
- protected function detail($id)
- {
- $show = new Show(SysConfig::findOrFail($id));
- $show->field('id', __('Id'));
- $show->field('name', __('系统名'));
- $show->field('hotline_number', __('咨询电话'));
- $show->field('hotline_number_pic', __('热线对应的图片'));
- $show->field('hot_search', __('热搜索关键词'));
- return $show;
- }
- /**
- * Make a form builder.
- *
- * @return Form
- */
- protected function form()
- {
- $form = new Form(new SysConfig());
- $form->text('name', __('系统名'));
- $form->text('hotline_number', __('咨询电话'));
- $form->image('hotline_number_pic', __('热线图片'))->uniqueName()->move('pics/'.date('Y').'/'.date('m'))->rules('required');
- $form->text('hot_search', __('热搜索关键词'));
- return $form;
- }
- }
|