filament-companies: does not work correctly inconjuction with Filament v3 tenancy enabled

in web.php of filament-companies the prefix is composed of $panel->getPath(), but when you haven’t specified a domain in tenancy of filament serviceprovider the generated route name is incorrect.

the official filament web.php does something like this:

$tenantRoutePrefix = $panel->getTenantRoutePrefix();
$tenantSlugAttribute = $panel->getTenantSlugAttribute();

Route::domain($domain)
   ->middleware($hasTenancy ? $panel->getMiddleware() : [])
   ->name("{$panelId}.")
   ->prefix($hasTenancy ? (($tenantRoutePrefix) ? "{$tenantRoutePrefix}/" : '') . ('{tenant' . (($tenantSlugAttribute) ? ":{$tenantSlugAttribute}" : '') . '}') : '')
   ->group(static function () use ($plugin, $hasTenancy, $tenantRoutePrefix, $tenantSlugAttribute) {

instead of in filament-companies web.php package file:

Route::domain($domain)
   ->middleware($panel->getMiddleware())
   ->name("{$panelId}.")
   ->prefix($panel->getPath())
   ->group(static function () use ($plugin, $hasTenancy) {

if you want to use it on multiple panels this should be changed…

Route::domain($domain)
   ->middleware($panel->getMiddleware())
   ->name("{$panelId}.")
   ->prefix($panel->getPath() . '/' . ($hasTenancy ? (($tenantRoutePrefix) ? "{$tenantRoutePrefix}/" : '') . ('{tenant' . (($tenantSlugAttribute) ? ":{$tenantSlugAttribute}" : '') . '}') : ''))
   ->group(static function () use ($plugin, $hasTenancy, $tenantRoutePrefix, $tenantSlugAttribute) {

About this issue

  • Original URL
  • State: closed
  • Created 6 months ago
  • Comments: 16 (11 by maintainers)

Most upvoted comments

@eelco2k The issue just mentioned should be fixed in the latest release.

That’s awesome! I will certainly use this. Thank you for this extended piece of code rework. ! Really appreciate it!