FilamentF
Filament2y ago
adnn

Many relationship manager?

In my database I have brands and products

I have a resource called Brand, and have tried making a relationship manager for Products. However, on my Brands table I don't have any product ids, because it can have hundreds.

my products table has a brand_id column

How do i properly set up this relationship in filament? Do I need to create an in between table?
Solution
php artisan make:filament-relation-manager BrandResource products name

Brand Model
public function products(): HasMany
{
    return $this->hasMany(Product::class);
}


Product Model
public function brand(): BelongsTo
{
    return $this->belongsTo(Brand::class);
}
Was this page helpful?