2023-08-14 13:22:29 +00: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-31 13:00:59 +00:00
|
|
|
$privateKeys = PrivateKey::ownedByCurrentTeam()->get();
|
2023-08-31 07:56:37 +00:00
|
|
|
if (!isCloud()) {
|
2023-08-14 13:25:03 +00:00
|
|
|
return view('server.create', [
|
|
|
|
'limit_reached' => false,
|
2023-08-31 13:00:59 +00:00
|
|
|
'private_keys' => $privateKeys,
|
2023-08-14 13:25:03 +00:00
|
|
|
]);
|
|
|
|
}
|
2023-08-31 13:00:59 +00:00
|
|
|
$team = currentTeam();
|
|
|
|
$servers = $team->servers->count();
|
|
|
|
['serverLimit' => $serverLimit] = $team->limits;
|
|
|
|
$limit_reached = $servers >= $serverLimit;
|
2023-08-14 13:25:03 +00:00
|
|
|
|
2023-08-14 13:22:29 +00:00
|
|
|
return view('server.create', [
|
|
|
|
'limit_reached' => $limit_reached,
|
2023-08-31 13:00:59 +00:00
|
|
|
'private_keys' => $privateKeys,
|
2023-08-14 13:22:29 +00:00
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|