mirror of
https://github.com/tiennm99/coolify.git
synced 2026-06-24 11:39:39 +00:00
refactor(team): make server limit methods accept optional team parameter
Allow serverLimit() and serverLimitReached() to accept an optional team parameter instead of relying solely on the current session. This improves testability and makes the methods more flexible by allowing them to work without session state. Add comprehensive tests covering various scenarios including no session, team at limit, and team under limit.
This commit is contained in:
@@ -586,7 +586,8 @@ class HetznerController extends Controller
|
||||
}
|
||||
|
||||
// Check server limit
|
||||
if (Team::serverLimitReached()) {
|
||||
$team = Team::find($teamId);
|
||||
if (Team::serverLimitReached($team)) {
|
||||
return response()->json(['message' => 'Server limit reached for your subscription.'], 400);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user