rupadana/filament-api-service

[Enhancement]: use $tenantModel->getRouteKeyName() instead of $tenantModel->getKeyName()

Opened this issue · 0 comments

What happened?

in HasHandlerTenantScope.php it's better to use getRouteKeyName() instead of ->getKeyName()

because if you want for security reasons want the "tenant" to have an UUID instead of an ID you can override the getRouteKeyName() in the Tenant Model, that way it will be used in all URLs and as the tenantID in filament is also an url attribute http://somedomain.com/admin/{tenant}/ it would be better to use the getRouteKeyName().

in Illuminate\Database\Eloquent\Model getRouteKeyName() returns also $this->getKeyName();

so it should fallback nicely.

 $tenant = $tenantModel::where(Filament::getCurrentPanel()->getTenantSlugAttribute() ?? $tenantModel->getRouteKeyName(), $tenantId)->first()

How to reproduce the bug

uuid as route

Package Version

latest

PHP Version

8.3

Laravel Version

10

Which operating systems does with happen with?

No response

Notes

No response