mirror of
https://github.com/Bigherollc/wticreatorstudio.git
synced 2026-09-22 00:13:46 -04:00
50 lines
1.3 KiB
PHP
50 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace Modules\Chat\Http\Controllers\API;
|
|
|
|
use Modules\Chat\Http\Controllers\AppBaseController;
|
|
use App\Models\Notification;
|
|
use Modules\Chat\Repositories\NotificationRepository;
|
|
use Illuminate\Http\JsonResponse;
|
|
|
|
/**
|
|
* Class NotificationController
|
|
*/
|
|
class NotificationController extends AppBaseController
|
|
{
|
|
/** @var NotificationRepository */
|
|
private $notificationRepo;
|
|
|
|
/**
|
|
* Create a new controller instance.
|
|
*
|
|
* @param NotificationRepository $notificationRepository
|
|
*/
|
|
public function __construct(NotificationRepository $notificationRepository)
|
|
{
|
|
$this->notificationRepo = $notificationRepository;
|
|
}
|
|
|
|
/**
|
|
* @param Notification $notification
|
|
*
|
|
* @return JsonResponse
|
|
*/
|
|
public function readNotification(Notification $notification)
|
|
{
|
|
$this->notificationRepo->readNotification($notification->id);
|
|
|
|
return $this->sendResponse($notification, 'Message read successfully.');
|
|
}
|
|
|
|
/**
|
|
* @return JsonResponse
|
|
*/
|
|
public function readAllNotification()
|
|
{
|
|
$messageSenderIds = $this->notificationRepo->readAllNotification();
|
|
|
|
return $this->sendResponse(['sender_ids' => $messageSenderIds], 'Read all messages successfully.');
|
|
}
|
|
}
|