2 months ago

laravel load() with paginate()

Posted 2 months ago by t0berius

Using the following query:

    $product->load(['stockItems' => function ($query) {

The results are fetched correctly (dd($product); shows the correct "batch" of related attributes), but when using:

{{ $product->stockItems->links() }}

inside blade it seems like the paginate() methos not called correctly, some expected methods are not available:

Method Illuminate\Database\Eloquent\Collection::links does not exist. (View:

Any idea how to get this solved?

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