Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Princechrisvic's avatar

Laravel Api pagination links() not working

I fetch a record from that has pagination my website A through API and want to display the result on my website B. The issue here is that it the {{$result->links()}} is not working. It keeps throwing an error "Method Illuminate\Support\Collection::links does not exist.".

So how then can we display Laravel API pagination in blade view?

0 likes
3 replies
Sinnbeck's avatar

Sounds like it isn't paginated. Show the code

Princechrisvic's avatar

@Sinnbeck

The API code in website A looks like this.

 public function homePage(){
        $products = Product::paginate(20);
					return response($products);
    }

and the website B (where the API is being called) looks like this

$result = collect(Http::get('https://websiteA.com/api/products')->json());

        return view('apiproduct',compact('result'));

Please or to participate in this conversation.