阶段性更新
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;
|
||||
}
|
||||
|
||||
@@ -12,13 +12,14 @@ use Encore\Admin\Grid;
|
||||
class TalentController extends AdminController
|
||||
{
|
||||
|
||||
protected $title = '领军人才梯队';
|
||||
protected $title = '人才梯队';
|
||||
|
||||
public function grid()
|
||||
{
|
||||
$grid = new Grid(new Talent());
|
||||
$grid->model()->latest('sort');
|
||||
$grid->column('id', '#ID#');
|
||||
$grid->column('category.title', '所属分类');
|
||||
$grid->column('sort', '排序(倒序显示)')->editable();
|
||||
$grid->column('title', '梯队名称');
|
||||
$grid->column('leader', '带头人');
|
||||
@@ -33,6 +34,10 @@ class TalentController extends AdminController
|
||||
$form = new Form(new Talent());
|
||||
|
||||
$form->text('title', '梯队名称')->required();
|
||||
$form->select('category_id', '所属分类')
|
||||
->options(Category::whereIn('id', [68, 69])->pluck('title', 'id'), '选择分类')
|
||||
->required();
|
||||
|
||||
$form->image('cover', '封面')
|
||||
->move('images/' . date('Y/m/d'))
|
||||
->removable()
|
||||
|
||||
Reference in New Issue
Block a user