D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
forge
/
ghanempharmacy.com
/
app
/
Http
/
Controllers
/
Admin
/
Filename :
AdminNotificationController.php
back
Copy
<?php namespace App\Http\Controllers\Admin; use App\Http\Controllers\Controller; use App\Models\AdminNotification; use Illuminate\Http\Request; class AdminNotificationController extends Controller { public function getNotifications() { $notifications = AdminNotification::orderBy('created_at', 'desc')->take(20)->get(); $unreadCount = AdminNotification::where('is_read', 0)->count(); return response()->json([ 'notifications' => $notifications, 'unread_count' => $unreadCount ]); } public function markAsRead($id) { AdminNotification::where('id', $id)->update(['is_read' => 1]); return response()->json(['success' => true]); } public function markAllAsRead() { AdminNotification::where('is_read', 0)->update(['is_read' => 1]); return response()->json(['success' => true]); } }