mirror of
https://github.com/flarum/core.git
synced 2025-10-11 15:04:25 +02:00
They will probably be refactored away at a later stage (when we get rid of the command bus). Until then, this lets us remove the Flarum\Core namespace and actually feels quite clean.
47 lines
1.0 KiB
PHP
47 lines
1.0 KiB
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\Notification\Command;
|
|
|
|
use Flarum\Notification\NotificationRepository;
|
|
use Flarum\User\AssertPermissionTrait;
|
|
|
|
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);
|
|
}
|
|
}
|