Add event action storage. Closes #2344
This commit is contained in:
@@ -13,6 +13,12 @@ namespace CachetHQ\Cachet\Bus\Events\Incident;
|
||||
|
||||
use CachetHQ\Cachet\Bus\Events\EventInterface;
|
||||
|
||||
/**
|
||||
* This is the incident event interface.
|
||||
*
|
||||
* @author Graham Campbell <graham@alt-three.com>
|
||||
* @author James Brooks <james@alt-three.com>
|
||||
*/
|
||||
interface IncidentEventInterface extends EventInterface
|
||||
{
|
||||
//
|
||||
|
||||
@@ -11,10 +11,19 @@
|
||||
|
||||
namespace CachetHQ\Cachet\Bus\Events\Incident;
|
||||
|
||||
use CachetHQ\Cachet\Bus\Events\ActionInterface;
|
||||
use CachetHQ\Cachet\Models\Incident;
|
||||
use CachetHQ\Cachet\Models\User;
|
||||
|
||||
final class IncidentWasRemovedEvent implements IncidentEventInterface
|
||||
final class IncidentWasRemovedEvent implements ActionInterface, IncidentEventInterface
|
||||
{
|
||||
/**
|
||||
* The user who removed the event.
|
||||
*
|
||||
* @var \CachetHQ\Cachet\Models\User
|
||||
*/
|
||||
public $user;
|
||||
|
||||
/**
|
||||
* The incident that has been removed.
|
||||
*
|
||||
@@ -25,12 +34,14 @@ final class IncidentWasRemovedEvent implements IncidentEventInterface
|
||||
/**
|
||||
* Create a new incident was removed event instance.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\User $user
|
||||
* @param \CachetHQ\Cachet\Models\Incident $incident
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Incident $incident)
|
||||
public function __construct(User $user, Incident $incident)
|
||||
{
|
||||
$this->user = $user;
|
||||
$this->incident = $incident;
|
||||
}
|
||||
|
||||
@@ -43,4 +54,17 @@ final class IncidentWasRemovedEvent implements IncidentEventInterface
|
||||
{
|
||||
return 'Incident was removed.';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the event action.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getAction()
|
||||
{
|
||||
return [
|
||||
'user' => $this->user,
|
||||
'description' => (string) $this,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,10 +11,19 @@
|
||||
|
||||
namespace CachetHQ\Cachet\Bus\Events\Incident;
|
||||
|
||||
use CachetHQ\Cachet\Bus\Events\ActionInterface;
|
||||
use CachetHQ\Cachet\Models\Incident;
|
||||
use CachetHQ\Cachet\Models\User;
|
||||
|
||||
final class IncidentWasReportedEvent implements IncidentEventInterface
|
||||
final class IncidentWasReportedEvent implements ActionInterface, IncidentEventInterface
|
||||
{
|
||||
/**
|
||||
* The user who reported the event.
|
||||
*
|
||||
* @var \CachetHQ\Cachet\Models\User
|
||||
*/
|
||||
public $user;
|
||||
|
||||
/**
|
||||
* The incident that has been reported.
|
||||
*
|
||||
@@ -32,13 +41,15 @@ final class IncidentWasReportedEvent implements IncidentEventInterface
|
||||
/**
|
||||
* Create a new incident has reported event instance.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\User $user
|
||||
* @param \CachetHQ\Cachet\Models\Incident $incident
|
||||
* @param bool $notify
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Incident $incident, $notify = false)
|
||||
public function __construct(User $user, Incident $incident, $notify = false)
|
||||
{
|
||||
$this->user = $user;
|
||||
$this->incident = $incident;
|
||||
$this->notify = $notify;
|
||||
}
|
||||
@@ -52,4 +63,17 @@ final class IncidentWasReportedEvent implements IncidentEventInterface
|
||||
{
|
||||
return 'Incident was reported.';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the event action.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getAction()
|
||||
{
|
||||
return [
|
||||
'user' => $this->user,
|
||||
'description' => (string) $this,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,10 +11,19 @@
|
||||
|
||||
namespace CachetHQ\Cachet\Bus\Events\Incident;
|
||||
|
||||
use CachetHQ\Cachet\Bus\Events\ActionInterface;
|
||||
use CachetHQ\Cachet\Models\Incident;
|
||||
use CachetHQ\Cachet\Models\User;
|
||||
|
||||
final class IncidentWasUpdatedEvent implements IncidentEventInterface
|
||||
final class IncidentWasUpdatedEvent implements ActionInterface, IncidentEventInterface
|
||||
{
|
||||
/**
|
||||
* The user who updated the event.
|
||||
*
|
||||
* @var \CachetHQ\Cachet\Models\User
|
||||
*/
|
||||
public $user;
|
||||
|
||||
/**
|
||||
* The incident that has been updated.
|
||||
*
|
||||
@@ -25,12 +34,14 @@ final class IncidentWasUpdatedEvent implements IncidentEventInterface
|
||||
/**
|
||||
* Create a new incident has updated event instance.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\User $user
|
||||
* @param \CachetHQ\Cachet\Models\Incident $incident
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Incident $incident)
|
||||
public function __construct(User $user, Incident $incident)
|
||||
{
|
||||
$this->user = $user;
|
||||
$this->incident = $incident;
|
||||
}
|
||||
|
||||
@@ -43,4 +54,17 @@ final class IncidentWasUpdatedEvent implements IncidentEventInterface
|
||||
{
|
||||
return 'Incident was updated.';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the event action.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getAction()
|
||||
{
|
||||
return [
|
||||
'user' => $this->user,
|
||||
'description' => (string) $this,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user