阶段性更新
This commit is contained in:
@@ -25,6 +25,10 @@ class IndexController extends AdminController
|
||||
return $model->where('status', 1)->whereIn('type', [Category::TYPE_ARTICLE, Category::TYPE_SHOW]);
|
||||
}, '所有分类'));
|
||||
});
|
||||
$filter->column(1 / 2, function ($filter) {
|
||||
$filter->equal('position', '定位')
|
||||
->select(Article::POSITIONS);
|
||||
});
|
||||
|
||||
$filter->disableIdFilter();
|
||||
});
|
||||
@@ -60,6 +64,7 @@ class IndexController extends AdminController
|
||||
'required' => '必须选择所属分类',
|
||||
'min' => '必须选择所属分类',
|
||||
]);
|
||||
|
||||
// $form->text('keywords', '关键词')->rules('nullable');
|
||||
$form->textarea('description', '内容简介')->rules('max:350');
|
||||
$form->image('cover', '封面')
|
||||
@@ -71,7 +76,19 @@ class IndexController extends AdminController
|
||||
$form->number('sort', '序号')->default(0)->rules('required', ['required' => '序号必须填写'])->help('倒序优先');
|
||||
$form->switch('status', '状态')->default(1);
|
||||
$form->text('url', '外链地址');
|
||||
$form->select('position', '定位')
|
||||
->options(Article::POSITIONS);
|
||||
$form->datetime('created_at', '发布时间');
|
||||
$form->saved(function ($form) {
|
||||
if ($form->position) {
|
||||
$model = $form->model();
|
||||
Article::where('position', $form->position)
|
||||
->where('id', '<>', $model->id)
|
||||
->update([
|
||||
'position' => '',
|
||||
]);
|
||||
}
|
||||
});
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user