mardi 22 septembre 2015

Laravel Eloquent Relationship Sub-Relationship?

I have an Offer class with the following relationship:

class Offer extends Model
{
    public function releases()
    {
        return $this->belongsToMany('App\Release');
    }
}

The Release class has this relationship:

class Release extends Model
{
    public function artist()
    {
        return $this->belongsTo('App\Artist');
    }
}

What is the simplest way of amending

   App\Offer::with('releases')->get();

So as to also get Artist information in each release?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire