PhillSparks solved it in chat:
$this->morphOne('App/User', 'userable');
This is an old post, but just a note for anyone else who found this from a Google search of morphOne() (morphOne() isn't documented in the Laravel docs, so there is scarce information about it)... An important thing to be aware of is that morphOne()'s save() method currently doesn't check to make sure there isn't already an existing associated child object.
So if you call morphOne()'s save() repeatedly with different child objects, it will associate multiple objects with the parent, even though there's only supposed to be one (so in the terminology of the above example, you could end up with multiple users associated with a Person object).
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community