微调
This commit is contained in:
@@ -21,7 +21,7 @@ class IndexController extends AdminController
|
|||||||
$grid->filter(function ($filter) {
|
$grid->filter(function ($filter) {
|
||||||
$filter->column(1 / 2, function ($filter) {
|
$filter->column(1 / 2, function ($filter) {
|
||||||
$filter->like('title', '文章标题');
|
$filter->like('title', '文章标题');
|
||||||
$filter->equal('category_id', '所属分类')
|
$filter->equal('categories.id', '所属分类')
|
||||||
->select(Category::selectOptions(function ($model) {
|
->select(Category::selectOptions(function ($model) {
|
||||||
return $model->where('status', 1)
|
return $model->where('status', 1)
|
||||||
->whereIn('type', [Category::TYPE_ARTICLE, Category::TYPE_SHOW]);
|
->whereIn('type', [Category::TYPE_ARTICLE, Category::TYPE_SHOW]);
|
||||||
|
|||||||
@@ -28,9 +28,16 @@ class CategorySelectAble extends Selectable
|
|||||||
|
|
||||||
$this->column('id', 'ID');
|
$this->column('id', 'ID');
|
||||||
$this->column('title', '分类名称');
|
$this->column('title', '分类名称');
|
||||||
|
$this->column('type', '类型')->using(Category::TYPES);
|
||||||
|
|
||||||
$this->filter(function (Filter $filter) {
|
$this->filter(function (Filter $filter) {
|
||||||
$filter->like('title', '分类名称');
|
$filter->like('title', '分类名称');
|
||||||
|
$filter->equal('parent.id', '所属分类')
|
||||||
|
->select(Category::selectOptions(function ($model) {
|
||||||
|
return $model->where('status', 1)
|
||||||
|
->whereIn('type', [Category::TYPE_ARTICLE, Category::TYPE_SHOW]);
|
||||||
|
}, '所有分类'));
|
||||||
|
$filter->equal('type', '类型')->select(Category::TYPES);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user