nova-inline-relationship icon indicating copy to clipboard operation
nova-inline-relationship copied to clipboard

Error Occurred when use HasOne Relation

Open phpMuhammed opened this issue 5 years ago • 1 comments

This is the relation between Brand and Attachment Models

// brand has one attachment
    public function attachment()
    {
        return $this->hasOne(Attachment::class);
    }
// attachment belongs to brand
	public function brand()
    {
        return $this->belongsTo(Brand::class);
    }

and this is the code in Brand Resource HasOne::make('attachment')->inline(),

finally this is the error

errorBrand

phpMuhammed avatar Feb 03 '20 10:02 phpMuhammed

@phpMuhammed The issue appears to be that you nee the HasOne field in the Attachment resource, and the BelongsTo field in the Brand resource. Try switching those and let me know if it fixes the issue.

brandonferens avatar Feb 03 '20 14:02 brandonferens