/**
  * Display a listing of the index resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     /*
      * --------------------------------------------------------------------------
      * Retrieve featured posts from Article model
      * --------------------------------------------------------------------------
      * Headline : indicate article with headline state
      * Trending : indicate article with trending state
      * Popular  : the top of post sort by most viewed on last 3 months
      * Ranked   : the top of post sort by most stared
      * Latest   : last published article
      */
     $article = new Article();
     $featured = $article->headline();
     $trending = $article->trending();
     $popular = $article->mostPopular();
     $ranked = $article->mostRanked();
     $latest = $article->latest();
     /*
      * --------------------------------------------------------------------------
      * Retrieve featured category
      * --------------------------------------------------------------------------
      * Selecting the most viewed articles on top 4 categories
      */
     $category = new Category();
     $summary = $category->featured();
     return view('pages.index', compact('featured', 'popular', 'ranked', 'trending', 'latest', 'summary'));
 }