📜  laravel 将模型添加到多态关系 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:33.258000             🧑  作者: Mango

代码示例1
//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);