1
0
mirror of https://github.com/flarum/core.git synced 2025-10-14 00:15:51 +02:00
Files
php-flarum/src/Notification/Command/ReadAllNotificationsHandler.php
2020-07-17 15:16:15 +02:00

42 lines
904 B
PHP

<?php
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\Notification\Command;
use Flarum\Notification\NotificationRepository;
class ReadAllNotificationsHandler
{
/**
* @var NotificationRepository
*/
protected $notifications;
/**
* @param NotificationRepository $notifications
*/
public function __construct(NotificationRepository $notifications)
{
$this->notifications = $notifications;
}
/**
* @param ReadAllNotifications $command
* @throws \Flarum\User\Exception\PermissionDeniedException
*/
public function handle(ReadAllNotifications $command)
{
$actor = $command->actor;
$actor->assertRegistered();
$this->notifications->markAllAsRead($actor);
}
}