mirror of
https://github.com/ericasch6/scrum-poker-internal.git
synced 2026-10-13 20:32:09 +00:00
34 lines
884 B
PHP
34 lines
884 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Http\Resources\DashboardRoomResource;
|
|
use App\Models\User;
|
|
use App\Services\Rooms\DashboardRoomService;
|
|
use Illuminate\Http\Request;
|
|
use Inertia\Inertia;
|
|
use Inertia\Response;
|
|
|
|
class DashboardController extends Controller
|
|
{
|
|
public function __construct(
|
|
private readonly DashboardRoomService $dashboardRooms,
|
|
) {}
|
|
|
|
public function __invoke(Request $request): Response
|
|
{
|
|
$user = $request->user();
|
|
|
|
abort_unless($user instanceof User, 403);
|
|
|
|
$rooms = $this->dashboardRooms->forUser($user);
|
|
|
|
return Inertia::render('Dashboard', [
|
|
'rooms' => DashboardRoomResource::collection($rooms['owned'])
|
|
->resolve($request),
|
|
'favoriteRooms' => DashboardRoomResource::collection($rooms['favorites'])
|
|
->resolve($request),
|
|
]);
|
|
}
|
|
}
|