[Vuejs]-Best way to paginate an array of data in laravel and use infinite scroll with vuejs

0👍

here a much faster version to retreive the posts.

public function feeds(){
    $userdIds = Auth::user()->friends()->pluck('id')->toArray();
    $userIds[] = Auth::id();

    $feed = Post::whereIn('user_id', $userIds)->orderBy('id', 'desc')->paginate(10);
    return $feed; 
}

-1👍

Thanks N69S
i finally came up this

    public function feeds(){
    $userIds = Auth::user()->friends_id();
    array_push($userIds, Auth::id());

    $feed = Posts::whereIn('user_id', $userIds)->orderBy('id', 'desc')->paginate(5);
    return $feed;
}

Leave a comment