2023-08-14 15:22:29 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
|
|
|
use App\Models\PrivateKey;
|
|
|
|
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
|
|
|
use Illuminate\Foundation\Validation\ValidatesRequests;
|
|
|
|
|
|
|
|
class ServerController extends Controller
|
|
|
|
{
|
|
|
|
use AuthorizesRequests, ValidatesRequests;
|
|
|
|
|
|
|
|
public function new_server()
|
|
|
|
{
|
2023-08-30 18:23:55 +02:00
|
|
|
if (!is_cloud()) {
|
2023-08-14 15:25:03 +02:00
|
|
|
return view('server.create', [
|
|
|
|
'limit_reached' => false,
|
|
|
|
'private_keys' => PrivateKey::ownedByCurrentTeam()->get(),
|
|
|
|
]);
|
|
|
|
}
|
2023-08-22 17:44:49 +02:00
|
|
|
$servers = currentTeam()->servers->count();
|
|
|
|
$subscription = currentTeam()?->subscription->type();
|
2023-08-21 10:18:11 +02:00
|
|
|
$your_limit = config('constants.limits.server')[strtolower($subscription)];
|
|
|
|
$limit_reached = $servers >= $your_limit;
|
2023-08-14 15:25:03 +02:00
|
|
|
|
2023-08-14 15:22:29 +02:00
|
|
|
return view('server.create', [
|
|
|
|
'limit_reached' => $limit_reached,
|
|
|
|
'private_keys' => PrivateKey::ownedByCurrentTeam()->get(),
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|