Skip to content

Instantly share code, notes, and snippets.

@neverything
Last active June 16, 2024 19:50
Show Gist options
  • Save neverything/b57d02ac421a24fb6cc00d3fbdd4855b to your computer and use it in GitHub Desktop.
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/
<?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