Skip to content

Commit

Permalink
Merge pull request #11857 from filamentphp/fix/scrollable-tenant-menu
Browse files Browse the repository at this point in the history
  • Loading branch information
danharrin committed Mar 23, 2024
1 parent 88d5003 commit 08673db
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion dist/theme.css

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions docs/11-tenancy.md
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ public function panel(Panel $panel): Panel
return $panel
// ...
->tenant(Team::class, slugAttribute: 'slug')
->tenantDomain('{tenant}.example.com');
->tenantDomain('{tenant:slug}.example.com');
}
```

Expand All @@ -719,13 +719,13 @@ public function panel(Panel $panel): Panel
return $panel
// ...
->tenant(Team::class, slugAttribute: 'domain')
->tenantDomain('{tenant}');
->tenantDomain('{tenant:domain}');
}
```

In this example, the `domain` attribute should contain a valid domain host, like `example.com` or `subdomain.example.com`.

> Note: when using a parameter for the entire domain (`tenantDomain('{tenant}')`), Filament will register a [global route parameter pattern](https://laravel.com/docs/routing#parameters-global-constraints) for all `tenant` parameters in the application to be `[a-z0-9.\-]+`. This is because Laravel does not allow the `.` character in route parameters by default. This might conflict with other panels using tenancy, or other parts of your application that use a `tenant` route parameter.
> Note: When using a parameter for the entire domain (`tenantDomain('{tenant:domain}')`), Filament will register a [global route parameter pattern](https://laravel.com/docs/routing#parameters-global-constraints) for all `tenant` parameters in the application to be `[a-z0-9.\-]+`. This is because Laravel does not allow the `.` character in route parameters by default. This might conflict with other panels using tenancy, or other parts of your application that use a `tenant` route parameter.
## Disabling tenancy for a resource

Expand Down
1 change: 1 addition & 0 deletions resources/views/components/tenant-menu.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
<x-filament::dropdown
placement="bottom-start"
teleport
size
:attributes="
\Filament\Support\prepare_inherited_attributes($attributes)
->class(['fi-tenant-menu'])
Expand Down
2 changes: 1 addition & 1 deletion src/Panel.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function register(): void
$this->registerLivewireComponents();
$this->registerLivewirePersistentMiddleware();

if ($this->getTenantDomain() === '{tenant}') {
if (str($this->getTenantDomain())->is(['{tenant}', '{tenant:*}'])) {
// Laravel does not match periods in route parameters by default.
Route::pattern('tenant', '[a-z0-9.\-]+');
}
Expand Down

0 comments on commit 08673db

Please sign in to comment.