function invoice() return $this->belongsTo(Invoice::class, 'invoice_id');}public function run() factory(Member::class, 100)->create()->each(functionHasOneOrMany::save() must be an instance of Illuminat
用户可以选择他想要查看的帖子类型。所以我创建了一个数据透视表posttype_user。现在我可以保存绑定到用户的所选postTypes。function users() return $this->belongsToMany(User::class);Post模型有一个带有postType_id的外键以及模型中的这种关系: public function postType()