Add event action storage. Closes #2344

This commit is contained in:
James Brooks
2017-02-03 22:34:13 +00:00
parent c2790e29cc
commit 3dc154dff1
92 changed files with 1512 additions and 128 deletions

View File

@@ -15,9 +15,29 @@ use CachetHQ\Cachet\Bus\Commands\Component\UpdateComponentCommand;
use CachetHQ\Cachet\Bus\Events\Component\ComponentStatusWasUpdatedEvent;
use CachetHQ\Cachet\Bus\Events\Component\ComponentWasUpdatedEvent;
use CachetHQ\Cachet\Models\Component;
use Illuminate\Contracts\Auth\Guard;
class UpdateComponentCommandHandler
{
/**
* The authentication guard instance.
*
* @var \Illuminate\Contracts\Auth\Guard
*/
protected $auth;
/**
* Create a new update component command handler instance.
*
* @param \Illuminate\Contracts\Auth\Guard $auth
*
* @return void
*/
public function __construct(Guard $auth)
{
$this->auth = $auth;
}
/**
* Handle the update component command.
*
@@ -30,11 +50,11 @@ class UpdateComponentCommandHandler
$component = $command->component;
$originalStatus = $component->status;
event(new ComponentStatusWasUpdatedEvent($component, $originalStatus, $command->status));
event(new ComponentStatusWasUpdatedEvent($this->auth->user(), $component, $originalStatus, $command->status));
$component->update($this->filter($command));
event(new ComponentWasUpdatedEvent($component));
event(new ComponentWasUpdatedEvent($this->auth->user(), $component));
return $component;
}