分类增加跳转url
This commit is contained in:
@@ -11,23 +11,28 @@ class CategoryController extends Controller
|
||||
//显示分类
|
||||
public function show(Category $category)
|
||||
{
|
||||
if ($category->type == Category::TYPE_SHOW) {
|
||||
if ($category->relations) {
|
||||
return redirect(route('article.show', $category->relations));
|
||||
}
|
||||
switch ($category->type) {
|
||||
case Category::TYPE_WEB:
|
||||
return redirect()->to($category->url);
|
||||
break;
|
||||
case Category::TYPE_SHOW:
|
||||
if ($category->relations) {
|
||||
return redirect(route('article.show', $category->relations));
|
||||
}
|
||||
|
||||
return redirect('/');
|
||||
return redirect('/');
|
||||
break;
|
||||
default:
|
||||
$articles = Article::where('category_id', $category->id)
|
||||
->latest('sort')
|
||||
->latest()
|
||||
->paginate();
|
||||
|
||||
$parent = $category->getTop();
|
||||
|
||||
return view('category.show', compact('category', 'parent', 'articles'));
|
||||
}
|
||||
|
||||
$articles = Article::where('category_id', $category->id)
|
||||
->latest('sort')
|
||||
->latest()
|
||||
->paginate();
|
||||
|
||||
$parent = $category->getTop();
|
||||
|
||||
return view('category.show', compact('category', 'parent', 'articles'));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user