set the notification getting system by created_at desc order

This commit is contained in:
2026-01-08 14:51:21 +01:00
parent c49a5e558f
commit 475a1c7052
2 changed files with 7 additions and 2 deletions
@@ -12,8 +12,13 @@ class NotificationsController extends Controller
{
public function getNotifications(Request $request): JsonResponse {
try {
$notif = $request->user()
->notifications()
->latest()
->get();
return response()->json([
'data' => $request->user()->notifications
'data' => $notif
]);
} catch(\Exception $e) {
Log::info($e->getMessage());