Refactor code to improve server limit retrieval in Team model

This commit is contained in:
Andras Bacsai
2024-10-28 10:08:52 +01:00
parent 5a0c00977c
commit 3cb6ba1a9d

View File

@@ -167,8 +167,12 @@ class Team extends Model implements SendsDiscord, SendsEmail
if (currentTeam()->id === 0 && isDev()) { if (currentTeam()->id === 0 && isDev()) {
return 9999999; return 9999999;
} }
$team = Team::find(currentTeam()->id);
if (! $team) {
return 0;
}
return Team::find(currentTeam()->id)->limits['serverLimit']; return data_get($team, 'limits.serverLimit', 0);
} }
public function limits(): Attribute public function limits(): Attribute