How to access resource from resource?

Help me, i want to access resource from resource i want to create "promo" from cars expected url like: http://127.0.0.1:8000/car/{carId}/promos so, when i create new promo, it will be related the car_id this is my code:
Action::make('view_promo')
->url(fn ($record) => PromoResource::getUrl('view', ['record' => $record->id])),
Action::make('view_promo')
->url(fn ($record) => PromoResource::getUrl('view', ['record' => $record->id])),
this is the result:
Route [filament.admin.resources.car.promos.view] not defined.
i have 2 models: "Cars" and "Promo"
class Car extends Model implements HasMedia
{
use HasFactory;
use InteractsWithMedia;

/**
* @var string
*/
protected $table = 'cars';

public function promos(): HasMany
{
return $this->hasMany(Promo::class, 'car_id');
}

...
}
class Car extends Model implements HasMedia
{
use HasFactory;
use InteractsWithMedia;

/**
* @var string
*/
protected $table = 'cars';

public function promos(): HasMany
{
return $this->hasMany(Promo::class, 'car_id');
}

...
}
class Original extends Model implements HasMedia
{
use HasFactory;
use InteractsWithMedia;

/**
* @var string
*/
protected $table = 'photos_car_original';

public function car(): BelongsTo
{
return $this->belongsTo(Car::class, 'car_id');
}
}
class Original extends Model implements HasMedia
{
use HasFactory;
use InteractsWithMedia;

/**
* @var string
*/
protected $table = 'photos_car_original';

public function car(): BelongsTo
{
return $this->belongsTo(Car::class, 'car_id');
}
}
can u help me? thanks
5 Replies
Dennis Koch
Dennis Koch13mo ago
So you are looking for nested resources? There are packages for it. It's not a core feature.
wandiaprianto
wandiapriantoOP13mo ago
what package Sir?
wandiaprianto
wandiapriantoOP13mo ago
GitHub
GitHub - laraxot/filament-nested-resources
Contribute to laraxot/filament-nested-resources development by creating an account on GitHub.
Dennis Koch
Dennis Koch13mo ago
There are multiple. I haven’t tried any so I can’t recommend one.
wandiaprianto
wandiapriantoOP13mo ago
okey, thankyou
Want results from more Discord servers?
Add your server