⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.19
Server IP:
178.33.27.10
Server:
Linux cpanel.dev-unit.com 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64
Server Software:
Apache/2.4.57 (Unix) OpenSSL/1.0.2k-fips
PHP Version:
8.2.11
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home
/
id
/
crm.dev-unit.com
/
app
/
Http
/
Controllers
/
View File Name :
NotificationController.php
<?php namespace App\Http\Controllers; use App\Models\Notification; use Carbon\Carbon; use Illuminate\Contracts\Foundation\Application; use Illuminate\Contracts\View\Factory; use Illuminate\Http\JsonResponse; use Illuminate\Support\Facades\Auth; use Illuminate\View\View; class NotificationController extends AppBaseController { /** * Display a listing of the resource. * * @return Application|Factory|JsonResponse|View */ public function index() { $notifications = Notification::whereUserId(Auth::id())->where('read_at', null)->orderByDesc('created_at')->get(); return $this->sendResponse($notifications, 'Notification retrieved successfully'); } /** * @param Notification $notification * @return JsonResponse */ public function readNotification(Notification $notification) { $notification->read_at = Carbon::now(); $notification->save(); return $this->sendSuccess(__('messages.notification.notification_read_successfully')); } /** * @return JsonResponse */ public function readAllNotification() { Notification::whereReadAt(null)->where('user_id', getLoggedInUserId())->update(['read_at' => Carbon::now()]); return $this->sendSuccess(__('messages.notification.all_notification_read_successfully')); } }