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

@@ -11,10 +11,19 @@
namespace CachetHQ\Cachet\Bus\Events\Metric;
use CachetHQ\Cachet\Bus\Events\ActionInterface;
use CachetHQ\Cachet\Models\Metric;
use CachetHQ\Cachet\Models\User;
final class MetricWasUpdatedEvent implements MetricEventInterface
final class MetricWasUpdatedEvent implements ActionInterface, MetricEventInterface
{
/**
* The user who update the metric.
*
* @var \CachetHQ\Cachet\Models\User
*/
public $user;
/**
* The metric that was updated.
*
@@ -25,12 +34,14 @@ final class MetricWasUpdatedEvent implements MetricEventInterface
/**
* Create a new metric was updated event instance.
*
* @param \CachetHQ\Cachet\Models\User $user
* @param \CachetHQ\Cachet\Models\Metric $metric
*
* @return void
*/
public function __construct(Metric $metric)
public function __construct(User $user, Metric $metric)
{
$this->user = $user;
$this->metric = $metric;
}
@@ -43,4 +54,17 @@ final class MetricWasUpdatedEvent implements MetricEventInterface
{
return 'Metric was updated.';
}
/**
* Get the event action.
*
* @return array
*/
public function getAction()
{
return [
'user' => $this->user,
'description' => (string) $this,
];
}
}