mirror of
https://github.com/tiennm99/coolify.git
synced 2026-08-20 08:23:25 +00:00
Adds v5 routing, middleware, home page rendering, team context sharing, project model/table support, and Flux health reporting. Installs Flux in container builds with role-aware s6 services and documents runtime roles.
45 lines
1.5 KiB
PHP
45 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\V5;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\Team;
|
|
use App\Models\User;
|
|
use App\Services\Flux\FluxHealth;
|
|
use Illuminate\Http\Request;
|
|
use Inertia\Inertia;
|
|
use Inertia\Response;
|
|
|
|
class HomeController extends Controller
|
|
{
|
|
public function __invoke(Request $request, FluxHealth $fluxHealth): Response
|
|
{
|
|
/** @var User $user */
|
|
$user = $request->user();
|
|
$currentTeam = $request->attributes->get('v5.currentTeam');
|
|
|
|
return Inertia::render('Home', [
|
|
'status' => 'v5-ready',
|
|
'flux' => $fluxHealth->check(),
|
|
'currentTeam' => $currentTeam instanceof Team ? [
|
|
'id' => $currentTeam->id,
|
|
'name' => $currentTeam->name,
|
|
'description' => $currentTeam->description,
|
|
'role' => $currentTeam->pivot?->role ?? $user->roleInTeam($currentTeam->id),
|
|
'personal' => $currentTeam->personal_team,
|
|
] : null,
|
|
'teams' => $user->teams()
|
|
->select('teams.id', 'teams.name', 'teams.description', 'teams.personal_team')
|
|
->orderBy('teams.name')
|
|
->get()
|
|
->map(fn (Team $team) => [
|
|
'id' => $team->id,
|
|
'name' => $team->name,
|
|
'description' => $team->description,
|
|
'role' => $team->pivot->role,
|
|
'personal' => $team->personal_team,
|
|
]),
|
|
]);
|
|
}
|
|
}
|