mirror of
https://github.com/ericasch6/scrum-poker-internal.git
synced 2026-10-13 16:32:09 +00:00
feat: some fixes to the ui, imlemented user and guest user, ans used the dahboard
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Room;
|
||||
use Illuminate\Http\Request;
|
||||
use Inertia\Inertia;
|
||||
use Inertia\Response;
|
||||
|
||||
class DashboardController extends Controller
|
||||
{
|
||||
public function __invoke(Request $request): Response
|
||||
{
|
||||
$rooms = $request->user()
|
||||
->ownedRooms()
|
||||
->withCount('players')
|
||||
->orderByRaw('closed_at IS NOT NULL')
|
||||
->orderByDesc('last_activity_at')
|
||||
->get()
|
||||
->map(fn (Room $room) => [
|
||||
'id' => $room->id,
|
||||
'title' => $room->title,
|
||||
'join_code' => $room->join_code,
|
||||
'current_round' => $room->current_round,
|
||||
'players_count' => $room->players_count,
|
||||
'last_activity_at' => $room->last_activity_at?->toIso8601String(),
|
||||
'closed_at' => $room->closed_at?->toIso8601String(),
|
||||
]);
|
||||
|
||||
return Inertia::render('Dashboard', [
|
||||
'rooms' => $rooms,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user