链街Dcat后台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

94 lines
2.7 KiB

<?php
namespace App\Admin\Controllers;
use App\Admin\Repositories\Banner;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Controllers\AdminController;
use App\Models\ImsCjdcMarket as MarketModel;
class BannerController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(new Banner(), function (Grid $grid) {
$grid->column('id')->sortable();
$grid->column('market_id');
$grid->column('title');
$grid->column('sub_title');
$grid->column('cover')->image(50);
$grid->column('cover_type');
$grid->column('path');
$grid->column('path_type');
$grid->column('sort');
$grid->column('status');
$grid->column('type');
$grid->column('created_at');
$grid->column('updated_at')->sortable();
$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 Banner(), function (Show $show) {
$show->field('id');
$show->field('market_id');
$show->field('title');
$show->field('sub_title');
$show->field('cover');
$show->field('cover_type');
$show->field('path');
$show->field('path_type');
$show->field('sort');
$show->field('status');
$show->field('type');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new Banner(), function (Form $form) {
$form->display('id');
// 市场
$marketList = MarketModel::getMarket();
$form->select('market_id')->width(4)->options($marketList);
$form->text('title');
$form->text('sub_title');
$form->image('cover')->width(2);
$form->select('cover_type')->options([1=>'图片', 2=>'视频']);
$form->text('path');
$form->select('path_type')->options(['page'=>'page','webview'=>'webview','applet'=>'applet']);
$form->text('sort');
$form->select('type')->options([1=>'首页banner']);
$form->display('created_at');
$form->display('updated_at');
});
}
}