Support the ongoing development of Laravel.io →
Database Eloquent
Last updated 1 year ago.
0

You can't limit eager load for list.

Meybe something like this?

    Account::with(
        [
            'transactions' => function ($comment) {
                    $comment->where('created_at', '<=', '1999-12-21');
                }
        ]
    )->get();

Or you can perform standard query with join to get all (last 3 transaction ids) and inject to with scope

Last updated 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Quanthir quanthir Joined 18 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.