update
This commit is contained in:
25
app/Http/Controllers/Dashboard/NotificationController.php
Normal file
25
app/Http/Controllers/Dashboard/NotificationController.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Dashboard;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\NotificationService;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class NotificationController extends Controller
|
||||
{
|
||||
public function __construct(private readonly NotificationService $notifications) {}
|
||||
|
||||
public function index(Request $request): View
|
||||
{
|
||||
$page = max(1, (int) $request->query('page', 1));
|
||||
$payload = $this->notifications->listForUser($request->user(), $page, 15);
|
||||
|
||||
return view('dashboard.notifications', [
|
||||
'notifications' => collect($payload['data'] ?? []),
|
||||
'notificationsMeta' => $payload['meta'] ?? [],
|
||||
'unreadCount' => (int) ($payload['unread_count'] ?? 0),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user