refactor: 修改文章列表
This commit is contained in:
@@ -21,7 +21,6 @@ class Article
|
||||
|
||||
$article = ArticleModel::withoutField([
|
||||
'language_id',
|
||||
'category_id',
|
||||
'author',
|
||||
'source',
|
||||
'desc',
|
||||
@@ -33,9 +32,10 @@ class Article
|
||||
'seo_keywords',
|
||||
'seo_desc'
|
||||
])
|
||||
->with('category')
|
||||
->where(function($query) use($param) {
|
||||
if (isset($param['category_id'])) {
|
||||
$query->category($param['category_id']);
|
||||
$query->where('category_id', '=', $param['category_id']);
|
||||
}
|
||||
})
|
||||
->withSearch(['title', 'created_at'], (function() use($param) {
|
||||
@@ -54,7 +54,12 @@ class Article
|
||||
->paginate([
|
||||
'page' => $param['page'],
|
||||
'list_rows' => $param['limit'],
|
||||
]);
|
||||
])
|
||||
->hidden([
|
||||
'category',
|
||||
'category_id'
|
||||
])
|
||||
->bindAttr('category', ['category_name' => 'name']);
|
||||
|
||||
return success('获取成功', $article);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user