
我叫做 eid 好像不好使啊。 是用在 product 和 tag 这两个实体之间。 这是定义在 product 模型上的
public function tags() { return $this->morphToMany(Tag::class, 'taggable'); } 相关表结构
products
tagables
1 run2 2017 年 3 月 24 日 https://laravel.com/api/5.4/Illuminate/Database/Eloquent/Concerns/HasRelationships.html#method_morphToMany MorphToMany morphToMany(string $related, string $name, string $table = null, string $foreignKey = null, string $relatedKey = null, bool $inverse = false) |
2 xx19941215 OP @sobigfish 好像不太对啊,这里是第几个值来设置父表的键?我试了$foreignKey 不太对啊啊 |