mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-21 09:12:14 +00:00
routes response refactoring
This commit is contained in:
@@ -18,7 +18,10 @@ class FlushUserNotificationsController extends Controller
|
||||
}
|
||||
|
||||
// Delete all notifications
|
||||
auth()->user()->notifications()->delete();
|
||||
auth()
|
||||
->user()
|
||||
->notifications()
|
||||
->delete();
|
||||
|
||||
return response()->json($successMessage);
|
||||
}
|
||||
|
||||
@@ -1,15 +1,18 @@
|
||||
<?php
|
||||
namespace Domain\Notifications\Controllers;
|
||||
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Domain\Notifications\Resources\NotificationCollection;
|
||||
|
||||
class GetUserNotificationsController extends Controller
|
||||
{
|
||||
public function __invoke(): NotificationCollection
|
||||
public function __invoke(): JsonResponse
|
||||
{
|
||||
return new NotificationCollection(
|
||||
$notifications = new NotificationCollection(
|
||||
auth()->user()->notifications
|
||||
);
|
||||
|
||||
return response()->json($notifications);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,9 +18,12 @@ class MarkUserNotificationsAsReadController extends Controller
|
||||
}
|
||||
|
||||
// Mark all notifications as read
|
||||
auth()->user()->unreadNotifications()->update([
|
||||
'read_at' => now(),
|
||||
]);
|
||||
auth()
|
||||
->user()
|
||||
->unreadNotifications()
|
||||
->update([
|
||||
'read_at' => now(),
|
||||
]);
|
||||
|
||||
return response()->json($successMessage);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user