Skip to content

Commit

Permalink
Merge pull request #11938 from filamentphp/improve-tenancy-example-in…
Browse files Browse the repository at this point in the history
…-docs

Improve tenancy example in docs
  • Loading branch information
danharrin authored Mar 19, 2024
2 parents d968aad + 172099e commit 4016c3f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/panels/docs/11-tenancy.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,19 +85,19 @@ class User extends Authenticatable implements FilamentUser, HasTenants
{
// ...

public function getTenants(Panel $panel): Collection
public function teams(): BelongsToMany
{
return $this->teams;
return $this->belongsToMany(Team::class);
}

public function teams(): BelongsToMany
public function getTenants(Panel $panel): Collection
{
return $this->belongsToMany(Team::class);
return $this->teams;
}

public function canAccessTenant(Model $tenant): bool
{
return $this->teams->contains($tenant);
return $this->teams()->whereKey($tenant)->exists();
}
}
```
Expand Down

0 comments on commit 4016c3f

Please sign in to comment.