lundi 19 décembre 2016

Laravel Eager Loading and dynamically bind model relationship

Laravel version: 5.3

In my User model class i have a method like :

public function hasOneRelation($model)
{
    return $this->hasOne($model);
}

And then i call this method like below code:

User::hasOneRelation('App\Client')->first();

i got the correct value but is there any N+1 problem.....



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire