Skip to content

Idea: Possible to eager load pivot relations on a model instance? #5

@empresarrollo

Description

@empresarrollo

Is it possible to load pivot relations on a model instance?

Taking the example on the README, say you have a controller method:

public function index(Plan $plan)
{

}

It would be great to be able to do something like:
$plan->load('items.planItem.unit');
or better yet:
$items = $plan->items()->orderBy('name')->with('planItem.unit')->get();
to return that to the view

thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions