文章分类由1变多
This commit is contained in:
@@ -13,7 +13,7 @@ use Illuminate\Support\Arr;
|
||||
* @Author: 玄尘
|
||||
* @Date : 2021/2/3 16:36
|
||||
* @param $categoryId
|
||||
* @param string $return
|
||||
* @param string $return
|
||||
* @return \App\Models\Category
|
||||
*/
|
||||
function getOneCategory($categoryId, $return = '')
|
||||
@@ -35,12 +35,13 @@ function getOneCategory($categoryId, $return = '')
|
||||
* @Author: 玄尘
|
||||
* @Date : 2020/9/10 13:21
|
||||
* @param $categoryId
|
||||
* @param string $result
|
||||
* @param string $result
|
||||
* @return \App\Models\Article
|
||||
*/
|
||||
function getOneArticleBYCate($categoryId, $result = '')
|
||||
{
|
||||
$info = Article::where('category_id', $categoryId)
|
||||
$info = Article::where('status', 1)
|
||||
->ByCategory($categoryId)
|
||||
->latest('sort')
|
||||
->latest()
|
||||
->first();
|
||||
@@ -68,8 +69,8 @@ function getOneArticleBYCate($categoryId, $result = '')
|
||||
*/
|
||||
function getArticlesBYCate($categoryId, $take)
|
||||
{
|
||||
$articles = Article::where('category_id', $categoryId)
|
||||
->where('status', 1)
|
||||
$articles = Article::where('status', 1)
|
||||
->ByCategory($categoryId)
|
||||
->latest('sort')
|
||||
->latest()
|
||||
->take($take)
|
||||
@@ -186,8 +187,9 @@ function getArtilesByCates($cate_id, $take = 8)
|
||||
->pluck('id')
|
||||
->toArray();
|
||||
|
||||
return Article::whereIn('category_id', $cate_ids)
|
||||
return Article::where('status', 1)
|
||||
->latest()
|
||||
->ByCategory($cate_ids)
|
||||
->take($take)
|
||||
->get();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user