What does your Transportation class look like?
The issue you're having is with what transportable() returns, not with Transportation itself.
Do you have a Transportation::transportable method that returns a belongsTo relationship?
Aggree with JoolsMcFly. I would check what $transportation->transportable() returns. If it is a relational model, it may not be able to get the related data.
Looks like transportable()
is supposed to return a morphed
relationship. I don't think it is possible to declare the morphed model from the Transportation
's side of view, because it doesn't know what kind of ride
or whatever other class it is supposed to morph to yet. Sounds weird, but anyway:
Maybe try to save the Transportation
from the Ride
's side of view:
$transportation = new Transportation;
$transportation = $ride->transportations()->save($transportation);
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community