How to save in a polymorphic relationship in Laravel?
It's simple like that, see this section.
Instead of manually setting the attribute on the videos, you may insert the Comment directly from the relationship's save method:
//Create a new Tag instance (fill the array with your own database fields)
$tag = new Tag(['name' => 'Foo bar.']);
//Find the video to insert into a tag
$video = Video::find(1);
//In the tag relationship, save a new video
$tag->videos()->save($video);
You can also try this which worked for me (morphMany):
$rel_data = ['assigned_type'=>'User','assigned_id'=>$user_model->getKey()];
$event->assigned_models()->create($rel_data);
you missed a step in the associate method, use this:
$tag->videos()->associate($video)->save();