List articles by category

The blog comes with a category filter option. To access this simply click on the category label next to a category.

You can find this functionality in App\Http\Blog\ArticlesCategoryController.php.


public function index(Category $category)
{
    $articles = \App\Article::published()->publishedUntilToday()->category($category->id)->paginate(10);

    return view('blog.articles_category', compact(['articles', 'category']));
}

The Resources\Views\Blog\Articles_category.blade.php gets and shows the articles that belong to a category.


<div class="row">
  <div class="col-md-10 ml-auto mr-auto">
    <h2 class="title">
      {{ $category->name }}
    </h2>
    <h4>
      {{ $category->description }}
    </h4>
    @include('blog._partials.article_full')
    @include('blog._partials.pagination')
  </div>
</div>