1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- <?php
- namespace App\Admin\Controllers;
- use App\Models\SysVersion;
- use Encore\Admin\Controllers\AdminController;
- use Encore\Admin\Form;
- use Encore\Admin\Grid;
- use Encore\Admin\Show;
- class SysVersionController extends AdminController
- {
- /**
- * Title for current resource.
- *
- * @var string
- */
- protected $title = 'APP版本';
- /**
- * Make a grid builder.
- *
- * @return Grid
- */
- protected function grid()
- {
- $grid = new Grid(new SysVersion());
- $grid->column('id', __('Id'));
- $grid->column('type', __('类型'))->display(function($type){
- return SysVersion::$typeMap[$type];
- });
- $grid->column('version_number', __('版本号'));
- $grid->column('description', __('版本更新说明'));
- $grid->column('web_url', __('版本下载网址'));
- $grid->column('aos_url', __('安卓下载地址'));
- $grid->column('ios_url', __('苹果下载地址'));
- $grid->column('is_must', __('是否强制更新'))->display(function($isMust){
- return SysVersion::$isMustMap[$isMust];
- });
- return $grid;
- }
- /**
- * Make a show builder.
- *
- * @param mixed $id
- * @return Show
- */
- protected function detail($id)
- {
- $show = new Show(SysVersion::findOrFail($id));
- $show->field('id', __('Id'));
- $show->field('type', __('Type'));
- $show->field('version_number', __('Version number'));
- $show->field('description', __('Description'));
- $show->field('web_url', __('Web url'));
- $show->field('aos_url', __('Aos url'));
- $show->field('ios_url', __('Ios url'));
- $show->field('is_must', __('Is must'));
- $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 SysVersion());
- $form->select('type', __('类型'))->options(SysVersion::$typeMap);
- $form->text('version_number', __('版本号'));
- $form->text('description', __('版本更新说明'));
- $form->file('web_url', __('版本下载网址'));
- $form->text('aos_url', __('安卓下载地址'));
- $form->text('ios_url', __('苹果下载地址'));
- $form->switch('is_must', __('是否强制更新'));
- return $form;
- }
- }
|