diff --git a/app/Admin/Controllers/Article/IndexController.php b/app/Admin/Controllers/Article/IndexController.php index 531eb81..5fbd658 100644 --- a/app/Admin/Controllers/Article/IndexController.php +++ b/app/Admin/Controllers/Article/IndexController.php @@ -21,7 +21,7 @@ class IndexController extends AdminController $grid->filter(function ($filter) { $filter->column(1 / 2, function ($filter) { $filter->like('title', '文章标题'); - $filter->equal('category_id', '所属分类') + $filter->equal('categories.id', '所属分类') ->select(Category::selectOptions(function ($model) { return $model->where('status', 1) ->whereIn('type', [Category::TYPE_ARTICLE, Category::TYPE_SHOW]); diff --git a/app/Admin/Selectable/CategorySelectAble.php b/app/Admin/Selectable/CategorySelectAble.php index bf24684..8af4db9 100644 --- a/app/Admin/Selectable/CategorySelectAble.php +++ b/app/Admin/Selectable/CategorySelectAble.php @@ -28,9 +28,16 @@ class CategorySelectAble extends Selectable $this->column('id', 'ID'); $this->column('title', '分类名称'); + $this->column('type', '类型')->using(Category::TYPES); $this->filter(function (Filter $filter) { $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); }); }