Laravel add model to polymorphic relationships
0
Programing Coderfunda February 23, 2022 Laravel, php No comments
//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);
0 comments:
Post a Comment
Thanks