我的模型看起来像下面的Product模型代码: public class Product extends Model public function types() ->withPivot('published');} 在nova ProjectResource中,我有以下字段: BelongsToMany[
我用的是Laravel 4,有两个型号: public function products() { return $this->belongsToMany('Asset');}
Product有标准的时间戳(created_at,updated_at),当我附加/分离Asset时,我想更新Product的updat
这个Laravel应用程序的原始开发人员离开了,现在我已经被移交了任务。管理员是在Nova创建的,我对此一无所知。我们有一个User.php资源,它可以拥有和图像,因为它是阿凡达。开发人员正在使用数据透视表图像,并使用了"MorphOne::make('image')“,但它给出了错误"HasOne relationship has filled”,但在图像表的DB中没有图像关
我想通过PivotModel来管理用户和角色,就像user belongsToMany Role和role belongsToMany users一样,所以扩展了Pivot的透视模型名称PivotModel,如何与PivotModel和User建立关系,从PivotModel中获取数据,就像PivotModel with users where role_id=1一样