0){
$grid->model()->where('tenant_id', '=', $__MINI_GLOBAL_TENANT_ID__);
}
$grid->model()->orderBy('id', 'desc');
$grid->column('id')->sortable();
// $grid->column('poster')->image('',80);
// $grid->column('sort')->editable();
$grid->column('type')->using(FieldUtils::getUrlTypesOne())->label([
'default' => 'primary', // 设置默认颜色,不设置则默认为 default
]);
$grid->column('target_id', '跳转id');
// $grid->column('slideshow_state')->switch();
// $grid->column('created_at');
$grid->column('updated_at')->sortable();
$grid->filter(function (Grid\Filter $filter) {
$filter->equal('id');
});
$grid->disableViewButton();
$grid->disableCreateButton();
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected function detail($id)
{
return Show::make($id, new WxXiangqin(), function (Show $show) {
$show->field('id');
$show->field('poster');
$show->field('target_id');
$show->field('slideshow_type');
$show->field('slideshow_state');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new WxXiangqin(), function (Form $form) {
$form->display('id')->help('路径大全');;
// $form->radio('slideshow_type')->options(FieldUtils::getUrlTypes())->default(0)->required();
$form->text('target_id', '跳转id')->help('路径大全');
// $form->switch('slideshow_state');
global $__MINI_GLOBAL_TENANT_ID__;
if($__MINI_GLOBAL_TENANT_ID__ > 0){
$form->text('tenant_id', '本站分应用id')->help('忽略这个配置')->default($__MINI_GLOBAL_TENANT_ID__);
}
$form->saving(function (Form $form){
global $__MINI_GLOBAL_TENANT_ID__;
$form->tenant_id = $__MINI_GLOBAL_TENANT_ID__;
});
$form->deleting(function (Form $form){
global $__MINI_GLOBAL_TENANT_ID__;
if($__MINI_GLOBAL_TENANT_ID__ > 0){
return $form->response()->error('权限不足,不可以删除其他分站对象');
}
});
});
}
}