Add event action storage. Closes #2344
This commit is contained in:
@@ -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 MetricWasRemovedEvent implements MetricEventInterface
|
||||
final class MetricWasRemovedEvent implements ActionInterface, MetricEventInterface
|
||||
{
|
||||
/**
|
||||
* The user who removed the metric.
|
||||
*
|
||||
* @var \CachetHQ\Cachet\Models\User
|
||||
*/
|
||||
public $user;
|
||||
|
||||
/**
|
||||
* The metric that was removed.
|
||||
*
|
||||
@@ -25,12 +34,14 @@ final class MetricWasRemovedEvent implements MetricEventInterface
|
||||
/**
|
||||
* Create a new metric was removed 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 MetricWasRemovedEvent implements MetricEventInterface
|
||||
{
|
||||
return 'Metric was removed.';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the event action.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getAction()
|
||||
{
|
||||
return [
|
||||
'user' => $this->user,
|
||||
'description' => (string) $this,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user