39 lines
1.0 KiB
PHP
39 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Game;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\ActivityLog;
|
|
use App\Models\Notification;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\View\View;
|
|
|
|
class DashboardController extends Controller
|
|
{
|
|
/**
|
|
* Display the game dashboard
|
|
*/
|
|
public function index(Request $request): View
|
|
{
|
|
$character = $request->user()->character;
|
|
|
|
if (!$character) {
|
|
return redirect()->route('game.character.create');
|
|
}
|
|
|
|
// Get recent activity logs
|
|
$recentActivity = ActivityLog::where('character_id', $character->id)
|
|
->latest()
|
|
->take(10)
|
|
->get();
|
|
|
|
// Get unread notifications
|
|
$unreadNotifications = $request->user()->notifications()
|
|
->whereNull('read_at')
|
|
->orderBy('created_at', 'desc')
|
|
->get();
|
|
|
|
return view('game.dashboard', compact('character', 'recentActivity', 'unreadNotifications'));
|
|
}
|
|
}
|