fix: self-hosted

This commit is contained in:
Andras Bacsai 2023-08-14 15:25:03 +02:00
parent e4279bf257
commit f8506f9d20

View File

@ -12,10 +12,17 @@ class ServerController extends Controller
public function new_server() public function new_server()
{ {
if (!is_cloud()) {
return view('server.create', [
'limit_reached' => false,
'private_keys' => PrivateKey::ownedByCurrentTeam()->get(),
]);
}
$servers = auth()->user()->currentTeam()->servers->count(); $servers = auth()->user()->currentTeam()->servers->count();
$subscription = auth()->user()->currentTeam()->subscription->type(); $subscription = auth()->user()->currentTeam()?->subscription->type();
$limits = config('constants.limits.server')[strtolower($subscription)]; $limits = config('constants.limits.server')[strtolower($subscription)];
$limit_reached = true ?? $servers >= $limits[$subscription]; $limit_reached = true ?? $servers >= $limits[$subscription];
return view('server.create', [ return view('server.create', [
'limit_reached' => $limit_reached, 'limit_reached' => $limit_reached,
'private_keys' => PrivateKey::ownedByCurrentTeam()->get(), 'private_keys' => PrivateKey::ownedByCurrentTeam()->get(),