文章关联多分类

This commit is contained in:
2021-04-02 10:35:51 +08:00
parent 28035e7a26
commit 96793afeec
20 changed files with 334 additions and 431 deletions

View File

@@ -29,7 +29,8 @@ class IndexController extends Controller
//通用获取文章
public function getArticle($category_ids, $take = 3)
{
return Article::whereIn('category_id', $category_ids)
return Article::where('status', 1)
->ByCategory($category_ids)
->select('id', 'description', 'title', 'created_at', 'cover', 'content')
->orderBy('created_at', 'desc')
->take($take)