filament-media-manager icon indicating copy to clipboard operation
filament-media-manager copied to clipboard

Tenancy issue when the route key is not the id

Open ainesophaur opened this issue 6 months ago • 1 comments

When building the URLs there are tenancy checks like the following

if(filament()->getTenant()){
  return redirect()->to(url(filament()->getCurrentPanel()->getId() .'/'. filament()->getTenant()->id . '/media?folder_id='.$arguments['record']['id']));
}

filament()->getCurrentPanel()->getId()

However, these calls break when the tenancy model has a route key other than id, for example, a slug key.

Navigating folders begins with the correct URL app/example/folders but then clicking a folder attempts to redirect to app/7/media?folder_id=3 which results in a 404

off the top of my head, the solution is probably to check filament()->getTenant()->getRouteKey()

I wouldn't mind submitting a PR to solve this but I'd imagine its in more areas.

ainesophaur avatar Aug 04 '24 02:08 ainesophaur