Last active
June 16, 2024 19:50
-
-
Save neverything/b57d02ac421a24fb6cc00d3fbdd4855b to your computer and use it in GitHub Desktop.
Filament: Get default tenant when using Jetstream https://silvanhagen.com/writing/filament-get-default-tenant-for-user/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class User extends Authenticatable implements HasDefaultTenant // and more stuff like FilamentUser, HasTenants, ... | |
{ | |
public function getDefaultTenant(Panel $panel): ?Model | |
{ | |
return $this->currentTeam ?? $this->allTeams()->first(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment