Skip to content

How can I eagerload an ApiRelation on an Eloquent model? Using the laravel bridge. #22

@BramBosSoliede

Description

@BramBosSoliede

How can I eagerload an ApiRelation on an Eloquent model?

Im doing Offerte::with('klant')->get()

where "Offerte" is an eloquent model which uses "HasApiRelations"
"Offerte" has this method:

    public function klant(){
        return $this->belongsTo(Klant::class, 'klant_id');
    }

"Klant" extends ApiModel which in turn extends Cristal\ApiWrapper\Bridges\Laravel\Model

when I run Offerte::with('klant')->get() the response is: "Exception: Call to a member function addEagerConstraints() on array".

What am I doing wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions