调整分类
This commit is contained in:
@@ -16,17 +16,15 @@ class ArticleController extends Controller
|
||||
*/
|
||||
public function show(Article $article)
|
||||
{
|
||||
$parent = $category = $article->category;
|
||||
if ($category->id) {
|
||||
$parent = getTopCate($category->id);
|
||||
}
|
||||
$categories = $article->categories;
|
||||
$next = Article::where('id', '>', $article->id)
|
||||
->whereHas('categories', function ($q) use ($categories) {
|
||||
$q->whereIN('id', $categories->pluck('id'));
|
||||
})
|
||||
->where('status', 1)
|
||||
->first();
|
||||
|
||||
$next = Article::where('id', '>', $article->id)
|
||||
->where('category_id', $article->category_id)
|
||||
->where('status', 1)
|
||||
->first();
|
||||
|
||||
return view('article.show', compact('article', 'next', 'parent', 'category'));
|
||||
return view('article.show', compact('article', 'next'));
|
||||
|
||||
}
|
||||
|
||||
@@ -38,7 +36,6 @@ class ArticleController extends Controller
|
||||
->when($title, function ($q) use ($title) {
|
||||
$q->where('title', 'like', "%{$title}%");
|
||||
})
|
||||
->where('category_id', '>', 0)
|
||||
->paginate();
|
||||
|
||||
return view('article.search', compact('articles'));
|
||||
|
||||
Reference in New Issue
Block a user