-
Notifications
You must be signed in to change notification settings - Fork 11.6k
Closed
Description
I just tried the example for the Polymorphic Relation from the docs:
class Photo extends Eloquent {
public function imageable()
{
return $this->morphTo();
}
}
class Staff extends Eloquent {
public function photos()
{
return $this->morphMany('Photo', 'imageable');
}
}
class Order extends Eloquent {
public function photos()
{
return $this->morphMany('Photo', 'imageable');
}
}With this code I tried to add a new Photo to a loaded Order:
// load order
$order = Order::find(1);
// create photo
$photo = new Photo
$photo->path = 'foo';
// save photo to the loaded model
$order->photos()->save($photo);I noticed that imageable_type is not set automatically. Is this not supported and do I have to set it manually or am I doing something wrong here?
ashish-banjare
Metadata
Metadata
Assignees
Labels
No labels