Relation Managers

why relation managers not working? I use the command: php artisan make:filament-relation-manager ProductResource categories name Product Model
public function categories(): HasMany
{
return $this->hasMany(Category::class);
}
public function categories(): HasMany
{
return $this->hasMany(Category::class);
}
Category Model
public function product(): BelongsTo
{
return $this->belongsTo(Product::class);
}
public function product(): BelongsTo
{
return $this->belongsTo(Product::class);
}
ProductResource.php
public static function getRelations(): array
{
return [
ProductCategoriesRelationManager::class,
];
}
public static function getRelations(): array
{
return [
ProductCategoriesRelationManager::class,
];
}
No description
2 Replies
Melomancheto
Melomancheto3d ago
Because you are creating resource. When you create the resource go into the resource and you will see it. It's not shown on listing and creating. Also make sure you have set the correct relation within ProductCategoriesRelationManager
topan
topanOP3d ago
@Melomancheto I don't understand about that. If both have the same hasMany relationship, what happens? Tag Model
public function product(): BelongsTo
{
return $this->belongsTo(Product::class);
}
public function product(): BelongsTo
{
return $this->belongsTo(Product::class);
}
Product Model
public function tags(): HasMany
{
return $this->hasMany(Tags::class);
}
public function tags(): HasMany
{
return $this->hasMany(Tags::class);
}
Want results from more Discord servers?
Add your server