I have a polymorphic relationship set up in an OrderItem
model, where saleable
can be a few different models.
I've set it up like any other relationship:
public function saleable()
{
return $this->morphTo()->withTrashed();
}
This used to work fine, now all of a sudden it doesn't work and it throws the error:
Call to undefined method Illuminate\Database\Query\Builder::withTrashed()
I don't understand why it would have stopped working, possibly due to a composer update which may have updated Laravel. I'm on v5.2.35. Any idea why it would have stopped working and what other solutions do I have?
UPDATE
Works fine with v5.2.33 and earlier. May be a bug, I've opened an issue on github