微调
This commit is contained in:
@@ -8,11 +8,13 @@ use App\Models\Category;
|
||||
|
||||
class ArticleController extends Controller
|
||||
{
|
||||
|
||||
public function index(Category $category)
|
||||
{
|
||||
$articles = Article::where('category_id', $category->id)
|
||||
->orderBy('created_at', 'desc')
|
||||
->paginate(5);
|
||||
->where('status', 1)
|
||||
->orderBy('created_at', 'desc')
|
||||
->paginate(5);
|
||||
|
||||
return view('articles.index', compact('articles', 'category'));
|
||||
}
|
||||
@@ -20,6 +22,7 @@ class ArticleController extends Controller
|
||||
public function show(Article $article)
|
||||
{
|
||||
$category = $article->category;
|
||||
|
||||
return view('articles.show', compact('article', 'category'));
|
||||
}
|
||||
|
||||
@@ -33,8 +36,9 @@ class ArticleController extends Controller
|
||||
public function picture(Category $category)
|
||||
{
|
||||
$articles = ArticlePicture::where('category_id', $category->id)
|
||||
->orderBy('created_at', 'desc')
|
||||
->paginate(12);
|
||||
->orderBy('created_at', 'desc')
|
||||
->paginate(12);
|
||||
|
||||
return view('articles.picture', compact('articles', 'category'));
|
||||
}
|
||||
|
||||
@@ -42,4 +46,5 @@ class ArticleController extends Controller
|
||||
{
|
||||
return view('articles.picshow', compact('article'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user