Laravel: Returning the namespaced owner of a polymorphic relation
There are 2 easy ways – one below, other one in @lukasgeiter’s answer as proposed by Taylor Otwell, which I definitely suggest checking as well: // app/config/app.php or anywhere you like ‘aliases’ => [ … ‘MorphOrder’ => ‘Some\Namespace\Order’, ‘MorphStaff’ => ‘Maybe\Another\Namespace\Staff’, … ] // Staff model protected $morphClass=”MorphStaff”; // Order model protected $morphClass=”MorphOrder”; done: $photo … Read more