mirror of
https://github.com/flarum/framework.git
synced 2025-05-19 21:22:36 +08:00
47 lines
1018 B
PHP
47 lines
1018 B
PHP
<?php
|
|
|
|
/*
|
|
* This file is part of Flarum.
|
|
*
|
|
* (c) Toby Zerner <toby.zerner@gmail.com>
|
|
*
|
|
* For the full copyright and license information, please view the LICENSE
|
|
* file that was distributed with this source code.
|
|
*/
|
|
|
|
namespace Flarum\Core\Command;
|
|
|
|
use Flarum\User\AssertPermissionTrait;
|
|
use Flarum\Notification\NotificationRepository;
|
|
|
|
class ReadAllNotificationsHandler
|
|
{
|
|
use AssertPermissionTrait;
|
|
|
|
/**
|
|
* @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;
|
|
|
|
$this->assertRegistered($actor);
|
|
|
|
$this->notifications->markAllAsRead($actor);
|
|
}
|
|
}
|