jeudi 2 novembre 2017

Laravel: Allow soft deleted models in a hasManyThrough relationship

I have a has many through relationship like this:

class Venue {
    public function orders()
    {
        return $this->hasManyThrough(Order::class, Offer::class);
    }
}

However the Offer model can be soft deleted: http://ift.tt/2iVGxUj

This means the function, will not return any orders that have a soft deleted offer.

How can I allow the function to return orders that have soft deleted offers.

Note that I am using Laravel 5.1 (although solutions in newer versions is appreciated).



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire