SmokeTM
1 year ago

I want my articles on the front page to slide down

Posted 1 year ago by SmokeTM

Hey guys I dont know how to tackle this problem. I want my articles to slide down. So that means I dont want my articles to be sorted every time a new article gets to the front page. The new article on the front page should slide down so there should be no new order. I hope you guys get what I mean. It should be like on HN if that helps.

    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
     public function index() {

        $articles = Article::with(['user' => function ($query) {
                $query->withTrashed();
            }])
           ->with('categorie', 'comments', 'votes')
           ->withCount('votes')
           ->where('created_at', '<=', Carbon::now()->subHour(1))
           ->where('is_active', true)
           ->paginate(25);

        return view('pages.article.articles', compact('articles'));
  }

Maybe there is a package for that? Ranking System?

Best regards

Please sign in or create an account to participate in this conversation.