From 3dc154dff1639caa57c7d62128e7a91e847a07d5 Mon Sep 17 00:00:00 2001 From: James Brooks Date: Fri, 3 Feb 2017 22:34:13 +0000 Subject: [PATCH 1/2] Add event action storage. Closes #2344 --- app/Bus/Events/ActionInterface.php | 28 +++++++ .../Component/ComponentEventInterface.php | 6 ++ .../ComponentStatusWasUpdatedEvent.php | 28 ++++++- .../Component/ComponentWasAddedEvent.php | 28 ++++++- .../Component/ComponentWasRemovedEvent.php | 33 +++++++- .../Component/ComponentWasUpdatedEvent.php | 28 ++++++- .../ComponentGroupEventInterface.php | 6 ++ .../ComponentGroupWasAddedEvent.php | 28 ++++++- .../ComponentGroupWasRemovedEvent.php | 28 ++++++- .../ComponentGroupWasUpdatedEvent.php | 28 ++++++- app/Bus/Events/EventInterface.php | 6 ++ .../Incident/IncidentEventInterface.php | 6 ++ .../Incident/IncidentWasRemovedEvent.php | 28 ++++++- .../Incident/IncidentWasReportedEvent.php | 28 ++++++- .../Incident/IncidentWasUpdatedEvent.php | 28 ++++++- .../IncidentUpdateWasRemovedEvent.php | 28 ++++++- .../IncidentUpdateWasReportedEvent.php | 28 ++++++- .../IncidentUpdateWasUpdatedEvent.php | 27 ++++++- .../Events/Invite/InviteEventInterface.php | 6 ++ .../Events/Metric/MetricEventInterface.php | 6 ++ .../Metric/MetricPointWasAddedEvent.php | 28 ++++++- .../Metric/MetricPointWasRemovedEvent.php | 28 ++++++- .../Metric/MetricPointWasUpdatedEvent.php | 28 ++++++- app/Bus/Events/Metric/MetricWasAddedEvent.php | 28 ++++++- .../Events/Metric/MetricWasRemovedEvent.php | 28 ++++++- .../Events/Metric/MetricWasUpdatedEvent.php | 28 ++++++- .../Schedule/ScheduleWasCreatedEvent.php | 28 ++++++- .../Schedule/ScheduleWasRemovedEvent.php | 28 ++++++- .../Schedule/ScheduleWasUpdatedEvent.php | 28 ++++++- .../Subscriber/SubscriberEventInterface.php | 6 ++ .../Events/User/UserAcceptedInviteEvent.php | 16 +++- .../Events/User/UserDisabledTwoAuthEvent.php | 16 +++- .../Events/User/UserEnabledTwoAuthEvent.php | 16 +++- app/Bus/Events/User/UserEventInterface.php | 6 ++ .../Events/User/UserFailedTwoAuthEvent.php | 16 +++- app/Bus/Events/User/UserLoggedInEvent.php | 16 +++- app/Bus/Events/User/UserLoggedOutEvent.php | 16 +++- .../Events/User/UserPassedTwoAuthEvent.php | 16 +++- .../User/UserRegeneratedApiTokenEvent.php | 16 +++- app/Bus/Events/User/UserWasAddedEvent.php | 16 +++- app/Bus/Events/User/UserWasInvitedEvent.php | 16 +++- app/Bus/Events/User/UserWasRemovedEvent.php | 16 +++- app/Bus/Events/User/UserWasWelcomedEvent.php | 16 +++- .../Component/AddComponentCommandHandler.php | 22 +++++- .../RemoveComponentCommandHandler.php | 22 +++++- .../UpdateComponentCommandHandler.php | 24 +++++- .../AddComponentGroupCommandHandler.php | 22 +++++- .../RemoveComponentGroupCommandHandler.php | 22 +++++- .../UpdateComponentGroupCommandHandler.php | 22 +++++- .../Incident/RemoveIncidentCommandHandler.php | 22 +++++- .../Incident/ReportIncidentCommandHandler.php | 14 +++- .../Incident/UpdateIncidentCommandHandler.php | 14 +++- .../RemoveIncidentUpdateCommandHandler.php | 22 +++++- .../ReportIncidentUpdateCommandHandler.php | 22 +++++- .../UpdateIncidentUpdateCommandHandler.php | 22 +++++- .../Metric/AddMetricCommandHandler.php | 22 +++++- .../Metric/AddMetricPointCommandHandler.php | 14 +++- .../Metric/RemoveMetricCommandHandler.php | 22 +++++- .../RemoveMetricPointCommandHandler.php | 22 +++++- .../Metric/UpdateMetricCommandHandler.php | 22 +++++- .../UpdateMetricPointCommandHandler.php | 14 +++- .../Schedule/CreateScheduleCommandHandler.php | 14 +++- .../Schedule/DeleteScheduleCommandHandler.php | 22 +++++- .../Schedule/UpdateScheduleCommandHandler.php | 14 +++- .../Handlers/Events/ActionStorageHandler.php | 49 ++++++++++++ app/Console/Commands/DemoSeederCommand.php | 12 +++ .../Providers/EventServiceProvider.php | 3 + app/Models/Action.php | 78 +++++++++++++++++++ .../2017_02_03_222218_CreateActionsTable.php | 45 +++++++++++ .../ComponentStatusWasUpdatedEventTest.php | 14 +++- .../Component/ComponentWasAddedEventTest.php | 5 +- .../ComponentWasRemovedEventTest.php | 5 +- .../ComponentWasUpdatedEventTest.php | 5 +- .../ComponentGroupWasAddedEventTest.php | 5 +- .../ComponentGroupWasRemovedEventTest.php | 5 +- .../ComponentGroupWasUpdatedEventTest.php | 5 +- .../Incident/IncidentWasRemovedEventTest.php | 5 +- .../Incident/IncidentWasReportedEventTest.php | 4 +- .../Incident/IncidentWasUpdatedEventTest.php | 5 +- .../IncidentUpdateWasRemovedEventTest.php | 5 +- .../IncidentUpdateWasReportedEventTest.php | 5 +- .../IncidentUpdateWasUpdatedEventTest.php | 5 +- .../Metric/MetricPointWasAddedEventTest.php | 5 +- .../Metric/MetricPointWasRemovedEventTest.php | 5 +- .../Metric/MetricPointWasUpdatedEventTest.php | 5 +- .../Events/Metric/MetricWasAddedEventTest.php | 5 +- .../Metric/MetricWasRemovedEventTest.php | 5 +- .../Metric/MetricWasUpdatedEventTest.php | 5 +- .../Schedule/ScheduleWasCreatedEventTest.php | 5 +- .../Schedule/ScheduleWasRemovedEventTest.php | 5 +- .../Schedule/ScheduleWasUpdatedEventTest.php | 5 +- tests/Models/ActionTest.php | 31 ++++++++ 92 files changed, 1512 insertions(+), 128 deletions(-) create mode 100644 app/Bus/Events/ActionInterface.php create mode 100644 app/Bus/Handlers/Events/ActionStorageHandler.php create mode 100644 app/Models/Action.php create mode 100644 database/migrations/2017_02_03_222218_CreateActionsTable.php create mode 100644 tests/Models/ActionTest.php diff --git a/app/Bus/Events/ActionInterface.php b/app/Bus/Events/ActionInterface.php new file mode 100644 index 000000000000..ae1bc1c8a543 --- /dev/null +++ b/app/Bus/Events/ActionInterface.php @@ -0,0 +1,28 @@ + + * @author James Brooks + */ +interface ActionInterface +{ + /** + * Get the event action. + * + * @return array + */ + public function getAction(); +} diff --git a/app/Bus/Events/Component/ComponentEventInterface.php b/app/Bus/Events/Component/ComponentEventInterface.php index 147c999c043a..281a811f7904 100644 --- a/app/Bus/Events/Component/ComponentEventInterface.php +++ b/app/Bus/Events/Component/ComponentEventInterface.php @@ -13,6 +13,12 @@ use CachetHQ\Cachet\Bus\Events\EventInterface; +/** + * This is the component event interface. + * + * @author Graham Campbell + * @author James Brooks + */ interface ComponentEventInterface extends EventInterface { // diff --git a/app/Bus/Events/Component/ComponentStatusWasUpdatedEvent.php b/app/Bus/Events/Component/ComponentStatusWasUpdatedEvent.php index 9450073d8eb9..e54ee375a525 100644 --- a/app/Bus/Events/Component/ComponentStatusWasUpdatedEvent.php +++ b/app/Bus/Events/Component/ComponentStatusWasUpdatedEvent.php @@ -11,15 +11,24 @@ namespace CachetHQ\Cachet\Bus\Events\Component; +use CachetHQ\Cachet\Bus\Events\ActionInterface; use CachetHQ\Cachet\Models\Component; +use CachetHQ\Cachet\Models\User; /** * This is the component status was updated event. * * @author James Brooks */ -final class ComponentStatusWasUpdatedEvent implements ComponentEventInterface +final class ComponentStatusWasUpdatedEvent implements ActionInterface, ComponentEventInterface { + /** + * The user who updated the component. + * + * @var \CachetHQ\Cachet\Models\User + */ + public $user; + /** * The component that was updated. * @@ -44,14 +53,16 @@ final class ComponentStatusWasUpdatedEvent implements ComponentEventInterface /** * Create a new component was updated event instance. * + * @param \CachetHQ\Cachet\Models\User $user * @param \CachetHQ\Cachet\Models\Component $component * @param int $original_status * @param int $new_status * * @return void */ - public function __construct(Component $component, $original_status, $new_status) + public function __construct(User $user, Component $component, $original_status, $new_status) { + $this->user = $user; $this->component = $component; $this->original_status = $original_status; $this->new_status = $new_status; @@ -66,4 +77,17 @@ public function __toString() { return 'Component status was updated.'; } + + /** + * Get the event action. + * + * @return array + */ + public function getAction() + { + return [ + 'user' => $this->user, + 'description' => (string) $this, + ]; + } } diff --git a/app/Bus/Events/Component/ComponentWasAddedEvent.php b/app/Bus/Events/Component/ComponentWasAddedEvent.php index 78097bf61faa..c33f369a7825 100644 --- a/app/Bus/Events/Component/ComponentWasAddedEvent.php +++ b/app/Bus/Events/Component/ComponentWasAddedEvent.php @@ -11,10 +11,19 @@ namespace CachetHQ\Cachet\Bus\Events\Component; +use CachetHQ\Cachet\Bus\Events\ActionInterface; use CachetHQ\Cachet\Models\Component; +use CachetHQ\Cachet\Models\User; -final class ComponentWasAddedEvent implements ComponentEventInterface +final class ComponentWasAddedEvent implements ActionInterface, ComponentEventInterface { + /** + * The user who added the component. + * + * @var \CachetHQ\Cachet\Models\User + */ + public $user; + /** * The component that was added. * @@ -25,12 +34,14 @@ final class ComponentWasAddedEvent implements ComponentEventInterface /** * Create a new component was added event instance. * + * @param \CachetHQ\Cachet\Models\User $user * @param \CachetHQ\Cachet\Models\Component $component * * @return void */ - public function __construct(Component $component) + public function __construct(User $user, Component $component) { + $this->user = $user; $this->component = $component; } @@ -43,4 +54,17 @@ public function __toString() { return 'Component was added.'; } + + /** + * Get the event action. + * + * @return array + */ + public function getAction() + { + return [ + 'user' => $this->user, + 'description' => (string) $this, + ]; + } } diff --git a/app/Bus/Events/Component/ComponentWasRemovedEvent.php b/app/Bus/Events/Component/ComponentWasRemovedEvent.php index bb78015b36a5..02dc3e64910a 100644 --- a/app/Bus/Events/Component/ComponentWasRemovedEvent.php +++ b/app/Bus/Events/Component/ComponentWasRemovedEvent.php @@ -11,10 +11,24 @@ namespace CachetHQ\Cachet\Bus\Events\Component; +use CachetHQ\Cachet\Bus\Events\ActionInterface; use CachetHQ\Cachet\Models\Component; +use CachetHQ\Cachet\Models\User; -final class ComponentWasRemovedEvent implements ComponentEventInterface +/** + * This is the component was removed event class. + * + * @author James Brooks + */ +final class ComponentWasRemovedEvent implements ActionInterface, ComponentEventInterface { + /** + * The user who removed the component. + * + * @var \CachetHQ\Cachet\Models\User + */ + public $user; + /** * The component that was removed. * @@ -25,12 +39,14 @@ final class ComponentWasRemovedEvent implements ComponentEventInterface /** * Create a new component was removed event instance. * + * @param \CachetHQ\Cachet\Models\User $user * @param \CachetHQ\Cachet\Models\Component $component * * @return void */ - public function __construct(Component $component) + public function __construct(User $user, Component $component) { + $this->user = $user; $this->component = $component; } @@ -43,4 +59,17 @@ public function __toString() { return 'Component was removed.'; } + + /** + * Get the event action. + * + * @return array + */ + public function getAction() + { + return [ + 'user' => $this->user, + 'description' => (string) $this, + ]; + } } diff --git a/app/Bus/Events/Component/ComponentWasUpdatedEvent.php b/app/Bus/Events/Component/ComponentWasUpdatedEvent.php index 1b46c16aff16..3349e4642fc0 100644 --- a/app/Bus/Events/Component/ComponentWasUpdatedEvent.php +++ b/app/Bus/Events/Component/ComponentWasUpdatedEvent.php @@ -11,7 +11,9 @@ namespace CachetHQ\Cachet\Bus\Events\Component; +use CachetHQ\Cachet\Bus\Events\ActionInterface; use CachetHQ\Cachet\Models\Component; +use CachetHQ\Cachet\Models\User; /** * This is the component was updated event class. @@ -19,8 +21,15 @@ * @author James Brooks * @author Graham Campbell */ -final class ComponentWasUpdatedEvent implements ComponentEventInterface +final class ComponentWasUpdatedEvent implements ActionInterface, ComponentEventInterface { + /** + * The user who updated the component. + * + * @var \CachetHQ\Cachet\Models\User + */ + public $user; + /** * The component that was updated. * @@ -31,12 +40,14 @@ final class ComponentWasUpdatedEvent implements ComponentEventInterface /** * Create a new component was updated event instance. * + * @param \CachetHQ\Cachet\Models\User $user * @param \CachetHQ\Cachet\Models\Component $component * * @return void */ - public function __construct(Component $component) + public function __construct(User $user, Component $component) { + $this->user = $user; $this->component = $component; } @@ -49,4 +60,17 @@ public function __toString() { return 'Component was updated.'; } + + /** + * Get the event action. + * + * @return array + */ + public function getAction() + { + return [ + 'user' => $this->user, + 'description' => (string) $this, + ]; + } } diff --git a/app/Bus/Events/ComponentGroup/ComponentGroupEventInterface.php b/app/Bus/Events/ComponentGroup/ComponentGroupEventInterface.php index 99d92b77dc8c..6e40f0ee24cf 100644 --- a/app/Bus/Events/ComponentGroup/ComponentGroupEventInterface.php +++ b/app/Bus/Events/ComponentGroup/ComponentGroupEventInterface.php @@ -13,6 +13,12 @@ use CachetHQ\Cachet\Bus\Events\EventInterface; +/** + * This is the component group event interface. + * + * @author Graham Campbell + * @author James Brooks + */ interface ComponentGroupEventInterface extends EventInterface { // diff --git a/app/Bus/Events/ComponentGroup/ComponentGroupWasAddedEvent.php b/app/Bus/Events/ComponentGroup/ComponentGroupWasAddedEvent.php index 6ea377de1270..a41501b55556 100644 --- a/app/Bus/Events/ComponentGroup/ComponentGroupWasAddedEvent.php +++ b/app/Bus/Events/ComponentGroup/ComponentGroupWasAddedEvent.php @@ -11,10 +11,19 @@ namespace CachetHQ\Cachet\Bus\Events\ComponentGroup; +use CachetHQ\Cachet\Bus\Events\ActionInterface; use CachetHQ\Cachet\Models\ComponentGroup; +use CachetHQ\Cachet\Models\User; -final class ComponentGroupWasAddedEvent implements ComponentGroupEventInterface +final class ComponentGroupWasAddedEvent implements ActionInterface, ComponentGroupEventInterface { + /** + * The user who added the component group. + * + * @var \CachetHQ\Cachet\Models\User + */ + public $user; + /** * The component group that was added. * @@ -25,12 +34,14 @@ final class ComponentGroupWasAddedEvent implements ComponentGroupEventInterface /** * Create a new component group was added event instance. * + * @param \CachetHQ\Cachet\Models\User $group * @param \CachetHQ\Cachet\Models\ComponentGroup $group * * @return void */ - public function __construct(ComponentGroup $group) + public function __construct(User $user, ComponentGroup $group) { + $this->user = $user; $this->group = $group; } @@ -43,4 +54,17 @@ public function __toString() { return 'Component Group was added.'; } + + /** + * Get the event action. + * + * @return array + */ + public function getAction() + { + return [ + 'user' => $this->user, + 'description' => (string) $this, + ]; + } } diff --git a/app/Bus/Events/ComponentGroup/ComponentGroupWasRemovedEvent.php b/app/Bus/Events/ComponentGroup/ComponentGroupWasRemovedEvent.php index ac2d3b56f725..1bf33fb08620 100644 --- a/app/Bus/Events/ComponentGroup/ComponentGroupWasRemovedEvent.php +++ b/app/Bus/Events/ComponentGroup/ComponentGroupWasRemovedEvent.php @@ -11,10 +11,19 @@ namespace CachetHQ\Cachet\Bus\Events\ComponentGroup; +use CachetHQ\Cachet\Bus\Events\ActionInterface; use CachetHQ\Cachet\Models\ComponentGroup; +use CachetHQ\Cachet\Models\User; -final class ComponentGroupWasRemovedEvent implements ComponentGroupEventInterface +final class ComponentGroupWasRemovedEvent implements ActionInterface, ComponentGroupEventInterface { + /** + * The user who removed the component group. + * + * @var \CachetHQ\Cachet\Models\User + */ + public $user; + /** * The component group that was removed. * @@ -25,12 +34,14 @@ final class ComponentGroupWasRemovedEvent implements ComponentGroupEventInterfac /** * Create a new component group was removed event instance. * + * @param \CachetHQ\Cachet\Models\User $user * @param \CachetHQ\Cachet\Models\ComponentGroup $group * * @return void */ - public function __construct(ComponentGroup $group) + public function __construct(User $user, ComponentGroup $group) { + $this->user = $user; $this->group = $group; } @@ -43,4 +54,17 @@ public function __toString() { return 'Component Group was removed.'; } + + /** + * Get the event action. + * + * @return array + */ + public function getAction() + { + return [ + 'user' => $this->user, + 'description' => (string) $this, + ]; + } } diff --git a/app/Bus/Events/ComponentGroup/ComponentGroupWasUpdatedEvent.php b/app/Bus/Events/ComponentGroup/ComponentGroupWasUpdatedEvent.php index ab0ae77a896c..5942f00c8b8e 100644 --- a/app/Bus/Events/ComponentGroup/ComponentGroupWasUpdatedEvent.php +++ b/app/Bus/Events/ComponentGroup/ComponentGroupWasUpdatedEvent.php @@ -11,10 +11,19 @@ namespace CachetHQ\Cachet\Bus\Events\ComponentGroup; +use CachetHQ\Cachet\Bus\Events\ActionInterface; use CachetHQ\Cachet\Models\ComponentGroup; +use CachetHQ\Cachet\Models\User; -final class ComponentGroupWasUpdatedEvent implements ComponentGroupEventInterface +final class ComponentGroupWasUpdatedEvent implements ActionInterface, ComponentGroupEventInterface { + /** + * The user who updated the component group. + * + * @var \CachetHQ\Cachet\Models\User + */ + public $user; + /** * The component group that was updated. * @@ -25,12 +34,14 @@ final class ComponentGroupWasUpdatedEvent implements ComponentGroupEventInterfac /** * Create a new component group was updated event instance. * + * @param \CachetHQ\Cachet\Models\User $user * @param \CachetHQ\Cachet\Models\ComponentGroup $group * * @return void */ - public function __construct(ComponentGroup $group) + public function __construct(User $user, ComponentGroup $group) { + $this->user = $user; $this->group = $group; } @@ -43,4 +54,17 @@ public function __toString() { return 'Component Group was updated.'; } + + /** + * Get the event action. + * + * @return array + */ + public function getAction() + { + return [ + 'user' => $this->user, + 'description' => (string) $this, + ]; + } } diff --git a/app/Bus/Events/EventInterface.php b/app/Bus/Events/EventInterface.php index 53013dfdb3a6..41a58b735b76 100644 --- a/app/Bus/Events/EventInterface.php +++ b/app/Bus/Events/EventInterface.php @@ -11,6 +11,12 @@ namespace CachetHQ\Cachet\Bus\Events; +/** + * This is the event interface. + * + * @author Graham Campbell + * @author James Brooks + */ interface EventInterface { // diff --git a/app/Bus/Events/Incident/IncidentEventInterface.php b/app/Bus/Events/Incident/IncidentEventInterface.php index a4cb6054f88b..31418b55781c 100644 --- a/app/Bus/Events/Incident/IncidentEventInterface.php +++ b/app/Bus/Events/Incident/IncidentEventInterface.php @@ -13,6 +13,12 @@ use CachetHQ\Cachet\Bus\Events\EventInterface; +/** + * This is the incident event interface. + * + * @author Graham Campbell + * @author James Brooks + */ interface IncidentEventInterface extends EventInterface { // diff --git a/app/Bus/Events/Incident/IncidentWasRemovedEvent.php b/app/Bus/Events/Incident/IncidentWasRemovedEvent.php index 0d46616aa73a..78a95f76127f 100644 --- a/app/Bus/Events/Incident/IncidentWasRemovedEvent.php +++ b/app/Bus/Events/Incident/IncidentWasRemovedEvent.php @@ -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 @@ public function __toString() { return 'Incident was removed.'; } + + /** + * Get the event action. + * + * @return array + */ + public function getAction() + { + return [ + 'user' => $this->user, + 'description' => (string) $this, + ]; + } } diff --git a/app/Bus/Events/Incident/IncidentWasReportedEvent.php b/app/Bus/Events/Incident/IncidentWasReportedEvent.php index d608199c4fb6..141fccb7f36f 100644 --- a/app/Bus/Events/Incident/IncidentWasReportedEvent.php +++ b/app/Bus/Events/Incident/IncidentWasReportedEvent.php @@ -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 @@ public function __toString() { return 'Incident was reported.'; } + + /** + * Get the event action. + * + * @return array + */ + public function getAction() + { + return [ + 'user' => $this->user, + 'description' => (string) $this, + ]; + } } diff --git a/app/Bus/Events/Incident/IncidentWasUpdatedEvent.php b/app/Bus/Events/Incident/IncidentWasUpdatedEvent.php index c4a6ba552246..7aa11322af1a 100644 --- a/app/Bus/Events/Incident/IncidentWasUpdatedEvent.php +++ b/app/Bus/Events/Incident/IncidentWasUpdatedEvent.php @@ -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 @@ public function __toString() { return 'Incident was updated.'; } + + /** + * Get the event action. + * + * @return array + */ + public function getAction() + { + return [ + 'user' => $this->user, + 'description' => (string) $this, + ]; + } } diff --git a/app/Bus/Events/IncidentUpdate/IncidentUpdateWasRemovedEvent.php b/app/Bus/Events/IncidentUpdate/IncidentUpdateWasRemovedEvent.php index e9096c17fba1..8618457fac23 100644 --- a/app/Bus/Events/IncidentUpdate/IncidentUpdateWasRemovedEvent.php +++ b/app/Bus/Events/IncidentUpdate/IncidentUpdateWasRemovedEvent.php @@ -11,15 +11,24 @@ namespace CachetHQ\Cachet\Bus\Events\IncidentUpdate; +use CachetHQ\Cachet\Bus\Events\ActionInterface; use CachetHQ\Cachet\Models\IncidentUpdate; +use CachetHQ\Cachet\Models\User; /** * This is the incident update was removed event. * * @author James Brooks */ -final class IncidentUpdateWasRemovedEvent implements IncidentUpdateEventInterface +final class IncidentUpdateWasRemovedEvent implements ActionInterface, IncidentUpdateEventInterface { + /** + * The user who removed the incident update. + * + * @var \CachetHQ\Cachet\Models\User + */ + public $user; + /** * The incident update that has been removed. * @@ -30,12 +39,14 @@ final class IncidentUpdateWasRemovedEvent implements IncidentUpdateEventInterfac /** * Create a new incident update was removed event instance. * + * @param \CachetHQ\Cachet\Models\User $user * @param \CachetHQ\Cachet\Models\IncidentUpdate $update * * @return void */ - public function __construct(IncidentUpdate $update) + public function __construct(User $user, IncidentUpdate $update) { + $this->user = $user; $this->update = $update; } @@ -48,4 +59,17 @@ public function __toString() { return 'Incident Update was removed.'; } + + /** + * Get the event action. + * + * @return array + */ + public function getAction() + { + return [ + 'user' => $this->user, + 'description' => (string) $this, + ]; + } } diff --git a/app/Bus/Events/IncidentUpdate/IncidentUpdateWasReportedEvent.php b/app/Bus/Events/IncidentUpdate/IncidentUpdateWasReportedEvent.php index 886eea2a75f7..52dadf881029 100644 --- a/app/Bus/Events/IncidentUpdate/IncidentUpdateWasReportedEvent.php +++ b/app/Bus/Events/IncidentUpdate/IncidentUpdateWasReportedEvent.php @@ -11,15 +11,24 @@ namespace CachetHQ\Cachet\Bus\Events\IncidentUpdate; +use CachetHQ\Cachet\Bus\Events\ActionInterface; use CachetHQ\Cachet\Models\IncidentUpdate; +use CachetHQ\Cachet\Models\User; /** * This is the incident update was reported event. * * @author James Brooks */ -final class IncidentUpdateWasReportedEvent implements IncidentUpdateEventInterface +final class IncidentUpdateWasReportedEvent implements ActionInterface, IncidentUpdateEventInterface { + /** + * The user who reported the incident update. + * + * @var \CachetHQ\Cachet\Models\User + */ + public $user; + /** * The incident update that has been reported. * @@ -30,12 +39,14 @@ final class IncidentUpdateWasReportedEvent implements IncidentUpdateEventInterfa /** * Create a new incident update was reported event instance. * + * @param \CachetHQ\Cachet\Models\User $user * @param \CachetHQ\Cachet\Models\IncidentUpdate $update * * @return void */ - public function __construct(IncidentUpdate $update) + public function __construct(User $user, IncidentUpdate $update) { + $this->user = $user; $this->update = $update; } @@ -48,4 +59,17 @@ public function __toString() { return 'Incident Update was reported.'; } + + /** + * Get the event action. + * + * @return array + */ + public function getAction() + { + return [ + 'user' => $this->user, + 'description' => (string) $this, + ]; + } } diff --git a/app/Bus/Events/IncidentUpdate/IncidentUpdateWasUpdatedEvent.php b/app/Bus/Events/IncidentUpdate/IncidentUpdateWasUpdatedEvent.php index 381f1a6e5b17..20e3782d73e0 100644 --- a/app/Bus/Events/IncidentUpdate/IncidentUpdateWasUpdatedEvent.php +++ b/app/Bus/Events/IncidentUpdate/IncidentUpdateWasUpdatedEvent.php @@ -11,15 +11,24 @@ namespace CachetHQ\Cachet\Bus\Events\IncidentUpdate; +use CachetHQ\Cachet\Bus\Events\ActionInterface; use CachetHQ\Cachet\Models\IncidentUpdate; +use CachetHQ\Cachet\Models\User; /** * This is the incident update was updated event. * * @author James Brooks */ -final class IncidentUpdateWasUpdatedEvent implements IncidentUpdateEventInterface +final class IncidentUpdateWasUpdatedEvent implements ActionInterface, IncidentUpdateEventInterface { + /** + * The user who updated the incident update. + * + * @var \CachetHQ\Cachet\Models\User + */ + public $user; + /** * The incident update that has been updated. * @@ -34,8 +43,9 @@ final class IncidentUpdateWasUpdatedEvent implements IncidentUpdateEventInterfac * * @return void */ - public function __construct(IncidentUpdate $update) + public function __construct(User $user, IncidentUpdate $update) { + $this->user = $user; $this->update = $update; } @@ -48,4 +58,17 @@ public function __toString() { return 'Incident Update was updated.'; } + + /** + * Get the event action. + * + * @return array + */ + public function getAction() + { + return [ + 'user' => $this->user, + 'description' => (string) $this, + ]; + } } diff --git a/app/Bus/Events/Invite/InviteEventInterface.php b/app/Bus/Events/Invite/InviteEventInterface.php index 35ccfc44ac69..63c199706b55 100644 --- a/app/Bus/Events/Invite/InviteEventInterface.php +++ b/app/Bus/Events/Invite/InviteEventInterface.php @@ -13,6 +13,12 @@ use CachetHQ\Cachet\Bus\Events\EventInterface; +/** + * This is the invite event interface. + * + * @author Graham Campbell + * @author James Brooks + */ interface InviteEventInterface extends EventInterface { // diff --git a/app/Bus/Events/Metric/MetricEventInterface.php b/app/Bus/Events/Metric/MetricEventInterface.php index 104a381a37e6..631b45492089 100644 --- a/app/Bus/Events/Metric/MetricEventInterface.php +++ b/app/Bus/Events/Metric/MetricEventInterface.php @@ -13,6 +13,12 @@ use CachetHQ\Cachet\Bus\Events\EventInterface; +/** + * This is the metric event interface. + * + * @author Graham Campbell + * @author James Brooks + */ interface MetricEventInterface extends EventInterface { // diff --git a/app/Bus/Events/Metric/MetricPointWasAddedEvent.php b/app/Bus/Events/Metric/MetricPointWasAddedEvent.php index ca5a7f58df74..02a57ae081c7 100644 --- a/app/Bus/Events/Metric/MetricPointWasAddedEvent.php +++ b/app/Bus/Events/Metric/MetricPointWasAddedEvent.php @@ -11,10 +11,19 @@ namespace CachetHQ\Cachet\Bus\Events\Metric; +use CachetHQ\Cachet\Bus\Events\ActionInterface; use CachetHQ\Cachet\Models\MetricPoint; +use CachetHQ\Cachet\Models\User; -final class MetricPointWasAddedEvent implements MetricEventInterface +final class MetricPointWasAddedEvent implements ActionInterface, MetricEventInterface { + /** + * The user who added the metric point. + * + * @var \CachetHQ\Cachet\Models\User + */ + public $user; + /** * The metric point that was added. * @@ -25,12 +34,14 @@ final class MetricPointWasAddedEvent implements MetricEventInterface /** * Create a new metric point was added event instance. * + * @param \CachetHQ\Cachet\Models\User $user * @param \CachetHQ\Cachet\Models\MetricPoint $metricPoint * * @return void */ - public function __construct(MetricPoint $metricPoint) + public function __construct(User $user, MetricPoint $metricPoint) { + $this->user = $user; $this->metricPoint = $metricPoint; } @@ -43,4 +54,17 @@ public function __toString() { return 'Metric Point was added.'; } + + /** + * Get the event action. + * + * @return array + */ + public function getAction() + { + return [ + 'user' => $this->user, + 'description' => (string) $this, + ]; + } } diff --git a/app/Bus/Events/Metric/MetricPointWasRemovedEvent.php b/app/Bus/Events/Metric/MetricPointWasRemovedEvent.php index 34d126bb42fe..85718a41d5da 100644 --- a/app/Bus/Events/Metric/MetricPointWasRemovedEvent.php +++ b/app/Bus/Events/Metric/MetricPointWasRemovedEvent.php @@ -11,10 +11,19 @@ namespace CachetHQ\Cachet\Bus\Events\Metric; +use CachetHQ\Cachet\Bus\Events\ActionInterface; use CachetHQ\Cachet\Models\MetricPoint; +use CachetHQ\Cachet\Models\User; -final class MetricPointWasRemovedEvent implements MetricEventInterface +final class MetricPointWasRemovedEvent implements ActionInterface, MetricEventInterface { + /** + * The user who removed the metric point. + * + * @var \CachetHQ\Cachet\Models\User + */ + public $user; + /** * The metric point that was removed. * @@ -25,12 +34,14 @@ final class MetricPointWasRemovedEvent implements MetricEventInterface /** * Create a new metric point was removed event instance. * + * @param \CachetHQ\Cachet\Models\User $user * @param \CachetHQ\Cachet\Models\MetricPoint $memtricPoint * * @return void */ - public function __construct(MetricPoint $metricPoint) + public function __construct(User $user, MetricPoint $metricPoint) { + $this->user = $user; $this->metricPoint = $metricPoint; } @@ -43,4 +54,17 @@ public function __toString() { return 'Metric Point was removed.'; } + + /** + * Get the event action. + * + * @return array + */ + public function getAction() + { + return [ + 'user' => $this->user, + 'description' => (string) $this, + ]; + } } diff --git a/app/Bus/Events/Metric/MetricPointWasUpdatedEvent.php b/app/Bus/Events/Metric/MetricPointWasUpdatedEvent.php index 5361681bbc6c..b61a595d111c 100644 --- a/app/Bus/Events/Metric/MetricPointWasUpdatedEvent.php +++ b/app/Bus/Events/Metric/MetricPointWasUpdatedEvent.php @@ -11,10 +11,19 @@ namespace CachetHQ\Cachet\Bus\Events\Metric; +use CachetHQ\Cachet\Bus\Events\ActionInterface; use CachetHQ\Cachet\Models\MetricPoint; +use CachetHQ\Cachet\Models\User; -final class MetricPointWasUpdatedEvent implements MetricEventInterface +final class MetricPointWasUpdatedEvent implements ActionInterface, MetricEventInterface { + /** + * The user who updated the metric point. + * + * @var \CachetHQ\Cachet\Models\User + */ + public $user; + /** * The metric point that was updated. * @@ -25,12 +34,14 @@ final class MetricPointWasUpdatedEvent implements MetricEventInterface /** * Create a new metric point was updated event instance. * + * @param \CachetHQ\Cachet\Models\User $user * @param \CachetHQ\Cachet\Models\MetricPoint $metricPoint * * @return void */ - public function __construct(MetricPoint $metricPoint) + public function __construct(User $user, MetricPoint $metricPoint) { + $this->user = $user; $this->metricPoint = $metricPoint; } @@ -43,4 +54,17 @@ public function __toString() { return 'Metric Point was updated.'; } + + /** + * Get the event action. + * + * @return array + */ + public function getAction() + { + return [ + 'user' => $this->user, + 'description' => (string) $this, + ]; + } } diff --git a/app/Bus/Events/Metric/MetricWasAddedEvent.php b/app/Bus/Events/Metric/MetricWasAddedEvent.php index f0abdbf36848..9ed5c4200e24 100644 --- a/app/Bus/Events/Metric/MetricWasAddedEvent.php +++ b/app/Bus/Events/Metric/MetricWasAddedEvent.php @@ -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 MetricWasAddedEvent implements MetricEventInterface +final class MetricWasAddedEvent implements ActionInterface, MetricEventInterface { + /** + * The user who added the metric. + * + * @var \CachetHQ\Cachet\Models\User + */ + public $user; + /** * The metric that was added. * @@ -25,12 +34,14 @@ final class MetricWasAddedEvent implements MetricEventInterface /** * Create a new metric was added 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 @@ public function __toString() { return 'Metric was added.'; } + + /** + * Get the event action. + * + * @return array + */ + public function getAction() + { + return [ + 'user' => $this->user, + 'description' => (string) $this, + ]; + } } diff --git a/app/Bus/Events/Metric/MetricWasRemovedEvent.php b/app/Bus/Events/Metric/MetricWasRemovedEvent.php index 5777e8051d22..7193f307f957 100644 --- a/app/Bus/Events/Metric/MetricWasRemovedEvent.php +++ b/app/Bus/Events/Metric/MetricWasRemovedEvent.php @@ -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 @@ public function __toString() { return 'Metric was removed.'; } + + /** + * Get the event action. + * + * @return array + */ + public function getAction() + { + return [ + 'user' => $this->user, + 'description' => (string) $this, + ]; + } } diff --git a/app/Bus/Events/Metric/MetricWasUpdatedEvent.php b/app/Bus/Events/Metric/MetricWasUpdatedEvent.php index 3850aae00b4f..48b1dc9cc6a7 100644 --- a/app/Bus/Events/Metric/MetricWasUpdatedEvent.php +++ b/app/Bus/Events/Metric/MetricWasUpdatedEvent.php @@ -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 @@ public function __toString() { return 'Metric was updated.'; } + + /** + * Get the event action. + * + * @return array + */ + public function getAction() + { + return [ + 'user' => $this->user, + 'description' => (string) $this, + ]; + } } diff --git a/app/Bus/Events/Schedule/ScheduleWasCreatedEvent.php b/app/Bus/Events/Schedule/ScheduleWasCreatedEvent.php index eea2a7a2ce85..1e1ecb4ee8e9 100644 --- a/app/Bus/Events/Schedule/ScheduleWasCreatedEvent.php +++ b/app/Bus/Events/Schedule/ScheduleWasCreatedEvent.php @@ -11,15 +11,24 @@ namespace CachetHQ\Cachet\Bus\Events\Schedule; +use CachetHQ\Cachet\Bus\Events\ActionInterface; use CachetHQ\Cachet\Models\Schedule; +use CachetHQ\Cachet\Models\User; /** * This is the schedule was created event class. * * @author James Brooks */ -final class ScheduleWasCreatedEvent implements ScheduleEventInterface +final class ScheduleWasCreatedEvent implements ActionInterface, ScheduleEventInterface { + /** + * The user that created the schedule. + * + * @var \CachetHQ\Cachet\Models\User + */ + public $user; + /** * The schedule that has been created. * @@ -30,12 +39,14 @@ final class ScheduleWasCreatedEvent implements ScheduleEventInterface /** * Create a new schedule was created event instance. * + * @param \CachetHQ\Cachet\Models\User $user * @param \CachetHQ\Cachet\Models\Schedule $schedule * * @return void */ - public function __construct(Schedule $schedule) + public function __construct(User $user, Schedule $schedule) { + $this->user = $user; $this->schedule = $schedule; } @@ -48,4 +59,17 @@ public function __toString() { return 'Schedule was created.'; } + + /** + * Get the event action. + * + * @return array + */ + public function getAction() + { + return [ + 'user' => $this->user, + 'description' => (string) $this, + ]; + } } diff --git a/app/Bus/Events/Schedule/ScheduleWasRemovedEvent.php b/app/Bus/Events/Schedule/ScheduleWasRemovedEvent.php index 07dcb047e102..525c77f79598 100644 --- a/app/Bus/Events/Schedule/ScheduleWasRemovedEvent.php +++ b/app/Bus/Events/Schedule/ScheduleWasRemovedEvent.php @@ -11,15 +11,24 @@ namespace CachetHQ\Cachet\Bus\Events\Schedule; +use CachetHQ\Cachet\Bus\Events\ActionInterface; use CachetHQ\Cachet\Models\Schedule; +use CachetHQ\Cachet\Models\User; /** * This is the schedule was removed event class. * * @author James Brooks */ -final class ScheduleWasRemovedEvent implements ScheduleEventInterface +final class ScheduleWasRemovedEvent implements ActionInterface, ScheduleEventInterface { + /** + * The user that removed the schedule. + * + * @var \CachetHQ\Cachet\Models\User + */ + public $user; + /** * The schedule that has been removed. * @@ -30,12 +39,14 @@ final class ScheduleWasRemovedEvent implements ScheduleEventInterface /** * Create a new schedule was removed event instance. * + * @param \CachetHQ\Cachet\Models\User $user * @param \CachetHQ\Cachet\Models\Schedule $schedule * * @return void */ - public function __construct(Schedule $schedule) + public function __construct(User $user, Schedule $schedule) { + $this->user = $user; $this->schedule = $schedule; } @@ -48,4 +59,17 @@ public function __toString() { return 'Schedule was removed.'; } + + /** + * Get the event action. + * + * @return array + */ + public function getAction() + { + return [ + 'user' => $this->user, + 'description' => (string) $this, + ]; + } } diff --git a/app/Bus/Events/Schedule/ScheduleWasUpdatedEvent.php b/app/Bus/Events/Schedule/ScheduleWasUpdatedEvent.php index 066eb4b19662..18fc46aaf5dc 100644 --- a/app/Bus/Events/Schedule/ScheduleWasUpdatedEvent.php +++ b/app/Bus/Events/Schedule/ScheduleWasUpdatedEvent.php @@ -11,15 +11,24 @@ namespace CachetHQ\Cachet\Bus\Events\Schedule; +use CachetHQ\Cachet\Bus\Events\ActionInterface; use CachetHQ\Cachet\Models\Schedule; +use CachetHQ\Cachet\Models\User; /** * This is the schedule was updated event class. * * @author James Brooks */ -final class ScheduleWasUpdatedEvent implements ScheduleEventInterface +final class ScheduleWasUpdatedEvent implements ActionInterface, ScheduleEventInterface { + /** + * The user that created the schedule. + * + * @var \CachetHQ\Cachet\Models\User + */ + public $user; + /** * The schedule that has been updated. * @@ -30,12 +39,14 @@ final class ScheduleWasUpdatedEvent implements ScheduleEventInterface /** * Create a new schedule was updated event instance. * + * @param \CachetHQ\Cachet\Models\User $user * @param \CachetHQ\Cachet\Models\Schedule $schedule * * @return void */ - public function __construct(Schedule $schedule) + public function __construct(User $user, Schedule $schedule) { + $this->user = $user; $this->schedule = $schedule; } @@ -48,4 +59,17 @@ public function __toString() { return 'Schedule was updated.'; } + + /** + * Get the event action. + * + * @return array + */ + public function getAction() + { + return [ + 'user' => $this->user, + 'description' => (string) $this, + ]; + } } diff --git a/app/Bus/Events/Subscriber/SubscriberEventInterface.php b/app/Bus/Events/Subscriber/SubscriberEventInterface.php index 24ed5b5af6d7..d8ec141182ee 100644 --- a/app/Bus/Events/Subscriber/SubscriberEventInterface.php +++ b/app/Bus/Events/Subscriber/SubscriberEventInterface.php @@ -13,6 +13,12 @@ use CachetHQ\Cachet\Bus\Events\EventInterface; +/** + * This is the subscriber event interface. + * + * @author Graham Campbell + * @author James Brooks + */ interface SubscriberEventInterface extends EventInterface { // diff --git a/app/Bus/Events/User/UserAcceptedInviteEvent.php b/app/Bus/Events/User/UserAcceptedInviteEvent.php index df6dd7a9cde4..6148c3dc62d8 100644 --- a/app/Bus/Events/User/UserAcceptedInviteEvent.php +++ b/app/Bus/Events/User/UserAcceptedInviteEvent.php @@ -11,6 +11,7 @@ namespace CachetHQ\Cachet\Bus\Events\User; +use CachetHQ\Cachet\Bus\Events\ActionInterface; use CachetHQ\Cachet\Models\Invite; use CachetHQ\Cachet\Models\User; @@ -19,7 +20,7 @@ * * @author James Brooks */ -final class UserAcceptedInviteEvent implements UserEventInterface +final class UserAcceptedInviteEvent implements ActionInterface, UserEventInterface { /** * The user that accepted the invite. @@ -58,4 +59,17 @@ public function __toString() { return 'User accepted invite.'; } + + /** + * Get the event action. + * + * @return array + */ + public function getAction() + { + return [ + 'user' => $this->user, + 'description' => (string) $this, + ]; + } } diff --git a/app/Bus/Events/User/UserDisabledTwoAuthEvent.php b/app/Bus/Events/User/UserDisabledTwoAuthEvent.php index b5364381c96e..a7646dbaae78 100644 --- a/app/Bus/Events/User/UserDisabledTwoAuthEvent.php +++ b/app/Bus/Events/User/UserDisabledTwoAuthEvent.php @@ -11,6 +11,7 @@ namespace CachetHQ\Cachet\Bus\Events\User; +use CachetHQ\Cachet\Bus\Events\ActionInterface; use CachetHQ\Cachet\Models\User; /** @@ -18,7 +19,7 @@ * * @author James Brooks */ -final class UserDisabledTwoAuthEvent implements UserEventInterface +final class UserDisabledTwoAuthEvent implements ActionInterface, UserEventInterface { /** * The user that disabled two auth. @@ -48,4 +49,17 @@ public function __toString() { return 'User disabled two-factor authentication.'; } + + /** + * Get the event action. + * + * @return array + */ + public function getAction() + { + return [ + 'user' => $this->user, + 'description' => (string) $this, + ]; + } } diff --git a/app/Bus/Events/User/UserEnabledTwoAuthEvent.php b/app/Bus/Events/User/UserEnabledTwoAuthEvent.php index 1fd69d609fda..9a13d045d303 100644 --- a/app/Bus/Events/User/UserEnabledTwoAuthEvent.php +++ b/app/Bus/Events/User/UserEnabledTwoAuthEvent.php @@ -11,6 +11,7 @@ namespace CachetHQ\Cachet\Bus\Events\User; +use CachetHQ\Cachet\Bus\Events\ActionInterface; use CachetHQ\Cachet\Models\User; /** @@ -18,7 +19,7 @@ * * @author James Brooks */ -final class UserEnabledTwoAuthEvent implements UserEventInterface +final class UserEnabledTwoAuthEvent implements ActionInterface, UserEventInterface { /** * The user that enabled two auth. @@ -48,4 +49,17 @@ public function __toString() { return 'User enabled two-factor authentication.'; } + + /** + * Get the event action. + * + * @return array + */ + public function getAction() + { + return [ + 'user' => $this->user, + 'description' => (string) $this, + ]; + } } diff --git a/app/Bus/Events/User/UserEventInterface.php b/app/Bus/Events/User/UserEventInterface.php index f36a4819a54f..be886a83430c 100644 --- a/app/Bus/Events/User/UserEventInterface.php +++ b/app/Bus/Events/User/UserEventInterface.php @@ -13,6 +13,12 @@ use CachetHQ\Cachet\Bus\Events\EventInterface; +/** + * This is the user event interface. + * + * @author Graham Campbell + * @author James Brooks + */ interface UserEventInterface extends EventInterface { // diff --git a/app/Bus/Events/User/UserFailedTwoAuthEvent.php b/app/Bus/Events/User/UserFailedTwoAuthEvent.php index 4b6a7beb2b0f..6fa1b015375c 100644 --- a/app/Bus/Events/User/UserFailedTwoAuthEvent.php +++ b/app/Bus/Events/User/UserFailedTwoAuthEvent.php @@ -11,6 +11,7 @@ namespace CachetHQ\Cachet\Bus\Events\User; +use CachetHQ\Cachet\Bus\Events\ActionInterface; use CachetHQ\Cachet\Models\User; /** @@ -18,7 +19,7 @@ * * @author James Brooks */ -final class UserFailedTwoAuthEvent implements UserEventInterface +final class UserFailedTwoAuthEvent implements ActionInterface, UserEventInterface { /** * The user that failed two auth. @@ -48,4 +49,17 @@ public function __toString() { return 'User failed two-factor authentication.'; } + + /** + * Get the event action. + * + * @return array + */ + public function getAction() + { + return [ + 'user' => $this->user, + 'description' => (string) $this, + ]; + } } diff --git a/app/Bus/Events/User/UserLoggedInEvent.php b/app/Bus/Events/User/UserLoggedInEvent.php index 1a15f6b19b7b..06aafe4419dc 100644 --- a/app/Bus/Events/User/UserLoggedInEvent.php +++ b/app/Bus/Events/User/UserLoggedInEvent.php @@ -11,6 +11,7 @@ namespace CachetHQ\Cachet\Bus\Events\User; +use CachetHQ\Cachet\Bus\Events\ActionInterface; use CachetHQ\Cachet\Models\User; /** @@ -18,7 +19,7 @@ * * @author James Brooks */ -final class UserLoggedInEvent implements UserEventInterface +final class UserLoggedInEvent implements ActionInterface, UserEventInterface { /** * The user that logged in. @@ -48,4 +49,17 @@ public function __toString() { return 'User logged in.'; } + + /** + * Get the event action. + * + * @return array + */ + public function getAction() + { + return [ + 'user' => $this->user, + 'description' => (string) $this, + ]; + } } diff --git a/app/Bus/Events/User/UserLoggedOutEvent.php b/app/Bus/Events/User/UserLoggedOutEvent.php index 31172292a6b7..98370606befb 100644 --- a/app/Bus/Events/User/UserLoggedOutEvent.php +++ b/app/Bus/Events/User/UserLoggedOutEvent.php @@ -11,6 +11,7 @@ namespace CachetHQ\Cachet\Bus\Events\User; +use CachetHQ\Cachet\Bus\Events\ActionInterface; use CachetHQ\Cachet\Models\User; /** @@ -18,7 +19,7 @@ * * @author James Brooks */ -final class UserLoggedOutEvent implements UserEventInterface +final class UserLoggedOutEvent implements ActionInterface, UserEventInterface { /** * The user that logged out. @@ -48,4 +49,17 @@ public function __toString() { return 'User logged out.'; } + + /** + * Get the event action. + * + * @return array + */ + public function getAction() + { + return [ + 'user' => $this->user, + 'description' => (string) $this, + ]; + } } diff --git a/app/Bus/Events/User/UserPassedTwoAuthEvent.php b/app/Bus/Events/User/UserPassedTwoAuthEvent.php index 020af5eec4c1..640938e5a682 100644 --- a/app/Bus/Events/User/UserPassedTwoAuthEvent.php +++ b/app/Bus/Events/User/UserPassedTwoAuthEvent.php @@ -11,6 +11,7 @@ namespace CachetHQ\Cachet\Bus\Events\User; +use CachetHQ\Cachet\Bus\Events\ActionInterface; use CachetHQ\Cachet\Models\User; /** @@ -18,7 +19,7 @@ * * @author James Brooks */ -final class UserPassedTwoAuthEvent implements UserEventInterface +final class UserPassedTwoAuthEvent implements ActionInterface, UserEventInterface { /** * The user that passed two auth. @@ -48,4 +49,17 @@ public function __toString() { return 'User passed two-factor authentication.'; } + + /** + * Get the event action. + * + * @return array + */ + public function getAction() + { + return [ + 'user' => $this->user, + 'description' => (string) $this, + ]; + } } diff --git a/app/Bus/Events/User/UserRegeneratedApiTokenEvent.php b/app/Bus/Events/User/UserRegeneratedApiTokenEvent.php index a81bd89f4d49..6dee91094fcd 100644 --- a/app/Bus/Events/User/UserRegeneratedApiTokenEvent.php +++ b/app/Bus/Events/User/UserRegeneratedApiTokenEvent.php @@ -11,6 +11,7 @@ namespace CachetHQ\Cachet\Bus\Events\User; +use CachetHQ\Cachet\Bus\Events\ActionInterface; use CachetHQ\Cachet\Models\User; /** @@ -18,7 +19,7 @@ * * @author James Brooks */ -final class UserRegeneratedApiTokenEvent implements UserEventInterface +final class UserRegeneratedApiTokenEvent implements ActionInterface, UserEventInterface { /** * The user that regenerated their api token. @@ -48,4 +49,17 @@ public function __toString() { return 'User regenerated api token.'; } + + /** + * Get the event action. + * + * @return array + */ + public function getAction() + { + return [ + 'user' => $this->user, + 'description' => (string) $this, + ]; + } } diff --git a/app/Bus/Events/User/UserWasAddedEvent.php b/app/Bus/Events/User/UserWasAddedEvent.php index 7fe620e10228..fb9d218e4a3b 100644 --- a/app/Bus/Events/User/UserWasAddedEvent.php +++ b/app/Bus/Events/User/UserWasAddedEvent.php @@ -11,9 +11,10 @@ namespace CachetHQ\Cachet\Bus\Events\User; +use CachetHQ\Cachet\Bus\Events\ActionInterface; use CachetHQ\Cachet\Models\User; -final class UserWasAddedEvent implements UserEventInterface +final class UserWasAddedEvent implements ActionInterface, UserEventInterface { /** * The user that has been added. @@ -43,4 +44,17 @@ public function __toString() { return 'User was added.'; } + + /** + * Get the event action. + * + * @return array + */ + public function getAction() + { + return [ + 'user' => $this->user, + 'description' => (string) $this, + ]; + } } diff --git a/app/Bus/Events/User/UserWasInvitedEvent.php b/app/Bus/Events/User/UserWasInvitedEvent.php index dec488e8c7aa..b51d57aac520 100644 --- a/app/Bus/Events/User/UserWasInvitedEvent.php +++ b/app/Bus/Events/User/UserWasInvitedEvent.php @@ -11,9 +11,10 @@ namespace CachetHQ\Cachet\Bus\Events\User; +use CachetHQ\Cachet\Bus\Events\ActionInterface; use CachetHQ\Cachet\Models\Invite; -final class UserWasInvitedEvent implements UserEventInterface +final class UserWasInvitedEvent implements ActionInterface, UserEventInterface { /** * The invite that has been added. @@ -43,4 +44,17 @@ public function __toString() { return 'User was invited.'; } + + /** + * Get the event action. + * + * @return array + */ + public function getAction() + { + return [ + 'user' => $this->user, + 'description' => (string) $this, + ]; + } } diff --git a/app/Bus/Events/User/UserWasRemovedEvent.php b/app/Bus/Events/User/UserWasRemovedEvent.php index d387c8f4c1a3..d44213403e51 100644 --- a/app/Bus/Events/User/UserWasRemovedEvent.php +++ b/app/Bus/Events/User/UserWasRemovedEvent.php @@ -11,9 +11,10 @@ namespace CachetHQ\Cachet\Bus\Events\User; +use CachetHQ\Cachet\Bus\Events\ActionInterface; use CachetHQ\Cachet\Models\User; -final class UserWasRemovedEvent implements UserEventInterface +final class UserWasRemovedEvent implements ActionInterface, UserEventInterface { /** * The user that has been removed. @@ -43,4 +44,17 @@ public function __toString() { return 'User was removed.'; } + + /** + * Get the event action. + * + * @return array + */ + public function getAction() + { + return [ + 'user' => $this->user, + 'description' => (string) $this, + ]; + } } diff --git a/app/Bus/Events/User/UserWasWelcomedEvent.php b/app/Bus/Events/User/UserWasWelcomedEvent.php index f00ce3aa274b..3f163cc5b6a1 100644 --- a/app/Bus/Events/User/UserWasWelcomedEvent.php +++ b/app/Bus/Events/User/UserWasWelcomedEvent.php @@ -11,6 +11,7 @@ namespace CachetHQ\Cachet\Bus\Events\User; +use CachetHQ\Cachet\Bus\Events\ActionInterface; use CachetHQ\Cachet\Models\User; /** @@ -18,7 +19,7 @@ * * @author James Brooks */ -final class UserWasWelcomedEvent implements UserEventInterface +final class UserWasWelcomedEvent implements ActionInterface, UserEventInterface { /** * The user. @@ -48,4 +49,17 @@ public function __toString() { return 'User was welcomed.'; } + + /** + * Get the event action. + * + * @return array + */ + public function getAction() + { + return [ + 'user' => $this->user, + 'description' => (string) $this, + ]; + } } diff --git a/app/Bus/Handlers/Commands/Component/AddComponentCommandHandler.php b/app/Bus/Handlers/Commands/Component/AddComponentCommandHandler.php index ffe506104ef2..fd22f323b514 100644 --- a/app/Bus/Handlers/Commands/Component/AddComponentCommandHandler.php +++ b/app/Bus/Handlers/Commands/Component/AddComponentCommandHandler.php @@ -14,9 +14,29 @@ use CachetHQ\Cachet\Bus\Commands\Component\AddComponentCommand; use CachetHQ\Cachet\Bus\Events\Component\ComponentWasAddedEvent; use CachetHQ\Cachet\Models\Component; +use Illuminate\Contracts\Auth\Guard; class AddComponentCommandHandler { + /** + * The authentication guard instance. + * + * @var \Illuminate\Contracts\Auth\Guard + */ + protected $auth; + + /** + * Create a new remove component command handler instance. + * + * @param \Illuminate\Contracts\Auth\Guard $auth + * + * @return void + */ + public function __construct(Guard $auth) + { + $this->auth = $auth; + } + /** * Handle the add component command. * @@ -28,7 +48,7 @@ public function handle(AddComponentCommand $command) { $component = Component::create($this->filter($command)); - event(new ComponentWasAddedEvent($component)); + event(new ComponentWasAddedEvent($this->auth->user(), $component)); return $component; } diff --git a/app/Bus/Handlers/Commands/Component/RemoveComponentCommandHandler.php b/app/Bus/Handlers/Commands/Component/RemoveComponentCommandHandler.php index 80451e2753d3..78e0acd71911 100644 --- a/app/Bus/Handlers/Commands/Component/RemoveComponentCommandHandler.php +++ b/app/Bus/Handlers/Commands/Component/RemoveComponentCommandHandler.php @@ -13,9 +13,29 @@ use CachetHQ\Cachet\Bus\Commands\Component\RemoveComponentCommand; use CachetHQ\Cachet\Bus\Events\Component\ComponentWasRemovedEvent; +use Illuminate\Contracts\Auth\Guard; class RemoveComponentCommandHandler { + /** + * The authentication guard instance. + * + * @var \Illuminate\Contracts\Auth\Guard + */ + protected $auth; + + /** + * Create a new remove component command handler instance. + * + * @param \Illuminate\Contracts\Auth\Guard $auth + * + * @return void + */ + public function __construct(Guard $auth) + { + $this->auth = $auth; + } + /** * Handle the remove component command. * @@ -27,7 +47,7 @@ public function handle(RemoveComponentCommand $command) { $component = $command->component; - event(new ComponentWasRemovedEvent($component)); + event(new ComponentWasRemovedEvent($this->auth->user(), $component)); $component->delete(); } diff --git a/app/Bus/Handlers/Commands/Component/UpdateComponentCommandHandler.php b/app/Bus/Handlers/Commands/Component/UpdateComponentCommandHandler.php index d7789f754c76..27e6cbb39ecf 100644 --- a/app/Bus/Handlers/Commands/Component/UpdateComponentCommandHandler.php +++ b/app/Bus/Handlers/Commands/Component/UpdateComponentCommandHandler.php @@ -15,9 +15,29 @@ 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 @@ public function handle(UpdateComponentCommand $command) $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; } diff --git a/app/Bus/Handlers/Commands/ComponentGroup/AddComponentGroupCommandHandler.php b/app/Bus/Handlers/Commands/ComponentGroup/AddComponentGroupCommandHandler.php index b2a935a86e97..9715f4a987b5 100644 --- a/app/Bus/Handlers/Commands/ComponentGroup/AddComponentGroupCommandHandler.php +++ b/app/Bus/Handlers/Commands/ComponentGroup/AddComponentGroupCommandHandler.php @@ -14,9 +14,29 @@ use CachetHQ\Cachet\Bus\Commands\ComponentGroup\AddComponentGroupCommand; use CachetHQ\Cachet\Bus\Events\ComponentGroup\ComponentGroupWasAddedEvent; use CachetHQ\Cachet\Models\ComponentGroup; +use Illuminate\Contracts\Auth\Guard; class AddComponentGroupCommandHandler { + /** + * The authentication guard instance. + * + * @var \Illuminate\Contracts\Auth\Guard + */ + protected $auth; + + /** + * Create a new add component group command handler instance. + * + * @param \Illuminate\Contracts\Auth\Guard $auth + * + * @return void + */ + public function __construct(Guard $auth) + { + $this->auth = $auth; + } + /** * Handle the add component group command. * @@ -33,7 +53,7 @@ public function handle(AddComponentGroupCommand $command) 'visible' => $command->visible, ]); - event(new ComponentGroupWasAddedEvent($group)); + event(new ComponentGroupWasAddedEvent($this->auth->user(), $group)); return $group; } diff --git a/app/Bus/Handlers/Commands/ComponentGroup/RemoveComponentGroupCommandHandler.php b/app/Bus/Handlers/Commands/ComponentGroup/RemoveComponentGroupCommandHandler.php index d74301494f5e..eef3b14e9304 100644 --- a/app/Bus/Handlers/Commands/ComponentGroup/RemoveComponentGroupCommandHandler.php +++ b/app/Bus/Handlers/Commands/ComponentGroup/RemoveComponentGroupCommandHandler.php @@ -13,9 +13,29 @@ use CachetHQ\Cachet\Bus\Commands\ComponentGroup\RemoveComponentGroupCommand; use CachetHQ\Cachet\Bus\Events\ComponentGroup\ComponentGroupWasRemovedEvent; +use Illuminate\Contracts\Auth\Guard; class RemoveComponentGroupCommandHandler { + /** + * The authentication guard instance. + * + * @var \Illuminate\Contracts\Auth\Guard + */ + protected $auth; + + /** + * Create a new remove component group command handler instance. + * + * @param \Illuminate\Contracts\Auth\Guard $auth + * + * @return void + */ + public function __construct(Guard $auth) + { + $this->auth = $auth; + } + /** * Handle the remove component group command. * @@ -27,7 +47,7 @@ public function handle(RemoveComponentGroupCommand $command) { $group = $command->group; - event(new ComponentGroupWasRemovedEvent($group)); + event(new ComponentGroupWasRemovedEvent($this->auth->user(), $group)); // Remove the group id from all component. $group->components->map(function ($component) { diff --git a/app/Bus/Handlers/Commands/ComponentGroup/UpdateComponentGroupCommandHandler.php b/app/Bus/Handlers/Commands/ComponentGroup/UpdateComponentGroupCommandHandler.php index ef0f3a07ef88..394b73c93400 100644 --- a/app/Bus/Handlers/Commands/ComponentGroup/UpdateComponentGroupCommandHandler.php +++ b/app/Bus/Handlers/Commands/ComponentGroup/UpdateComponentGroupCommandHandler.php @@ -13,9 +13,29 @@ use CachetHQ\Cachet\Bus\Commands\ComponentGroup\UpdateComponentGroupCommand; use CachetHQ\Cachet\Bus\Events\ComponentGroup\ComponentGroupWasUpdatedEvent; +use Illuminate\Contracts\Auth\Guard; class UpdateComponentGroupCommandHandler { + /** + * 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 group command. * @@ -28,7 +48,7 @@ public function handle(UpdateComponentGroupCommand $command) $group = $command->group; $group->update($this->filter($command)); - event(new ComponentGroupWasUpdatedEvent($group)); + event(new ComponentGroupWasUpdatedEvent($this->auth->user(), $group)); return $group; } diff --git a/app/Bus/Handlers/Commands/Incident/RemoveIncidentCommandHandler.php b/app/Bus/Handlers/Commands/Incident/RemoveIncidentCommandHandler.php index 38196c666fac..5fa7fbf3730a 100644 --- a/app/Bus/Handlers/Commands/Incident/RemoveIncidentCommandHandler.php +++ b/app/Bus/Handlers/Commands/Incident/RemoveIncidentCommandHandler.php @@ -13,9 +13,29 @@ use CachetHQ\Cachet\Bus\Commands\Incident\RemoveIncidentCommand; use CachetHQ\Cachet\Bus\Events\Incident\IncidentWasRemovedEvent; +use Illuminate\Contracts\Auth\Guard; class RemoveIncidentCommandHandler { + /** + * The authentication guard instance. + * + * @var \Illuminate\Contracts\Auth\Guard + */ + protected $auth; + + /** + * Create a new remove incident command handler instance. + * + * @param \Illuminate\Contracts\Auth\Guard $auth + * + * @return void + */ + public function __construct(Guard $auth) + { + $this->auth = $auth; + } + /** * Handle the remove incident command. * @@ -27,7 +47,7 @@ public function handle(RemoveIncidentCommand $command) { $incident = $command->incident; - event(new IncidentWasRemovedEvent($incident)); + event(new IncidentWasRemovedEvent($this->auth->user(), $incident)); $incident->delete(); } diff --git a/app/Bus/Handlers/Commands/Incident/ReportIncidentCommandHandler.php b/app/Bus/Handlers/Commands/Incident/ReportIncidentCommandHandler.php index 5f3f3dbce91c..7ee9be7005a0 100644 --- a/app/Bus/Handlers/Commands/Incident/ReportIncidentCommandHandler.php +++ b/app/Bus/Handlers/Commands/Incident/ReportIncidentCommandHandler.php @@ -20,6 +20,7 @@ use CachetHQ\Cachet\Models\IncidentTemplate; use CachetHQ\Cachet\Services\Dates\DateFactory; use Carbon\Carbon; +use Illuminate\Contracts\Auth\Guard; use Twig_Environment; use Twig_Loader_Array; @@ -30,6 +31,13 @@ */ class ReportIncidentCommandHandler { + /** + * The authentication guard instance. + * + * @var \Illuminate\Contracts\Auth\Guard + */ + protected $auth; + /** * The date factory instance. * @@ -40,12 +48,14 @@ class ReportIncidentCommandHandler /** * Create a new report incident command handler instance. * + * @param \Illuminate\Contracts\Auth\Guard $auth * @param \CachetHQ\Cachet\Services\Dates\DateFactory $dates * * @return void */ - public function __construct(DateFactory $dates) + public function __construct(Guard $auth, DateFactory $dates) { + $this->auth = $auth; $this->dates = $dates; } @@ -105,7 +115,7 @@ public function handle(ReportIncidentCommand $command) )); } - event(new IncidentWasReportedEvent($incident, (bool) $command->notify)); + event(new IncidentWasReportedEvent($this->auth->user(), $incident, (bool) $command->notify)); return $incident; } diff --git a/app/Bus/Handlers/Commands/Incident/UpdateIncidentCommandHandler.php b/app/Bus/Handlers/Commands/Incident/UpdateIncidentCommandHandler.php index 6b225735d7a5..555ec22f8bfa 100644 --- a/app/Bus/Handlers/Commands/Incident/UpdateIncidentCommandHandler.php +++ b/app/Bus/Handlers/Commands/Incident/UpdateIncidentCommandHandler.php @@ -19,6 +19,7 @@ use CachetHQ\Cachet\Models\Incident; use CachetHQ\Cachet\Models\IncidentTemplate; use CachetHQ\Cachet\Services\Dates\DateFactory; +use Illuminate\Contracts\Auth\Guard; use Twig_Environment; use Twig_Loader_Array; @@ -29,6 +30,13 @@ */ class UpdateIncidentCommandHandler { + /** + * The authentication guard instance. + * + * @var \Illuminate\Contracts\Auth\Guard + */ + protected $auth; + /** * The date factory instance. * @@ -39,12 +47,14 @@ class UpdateIncidentCommandHandler /** * Create a new update incident command handler instance. * + * @param \Illuminate\Contracts\Auth\Guard $auth * @param \CachetHQ\Cachet\Services\Dates\DateFactory $dates * * @return void */ - public function __construct(DateFactory $dates) + public function __construct(Guard $auth, DateFactory $dates) { + $this->auth = $auth; $this->dates = $dates; } @@ -91,7 +101,7 @@ public function handle(UpdateIncidentCommand $command) )); } - event(new IncidentWasUpdatedEvent($incident)); + event(new IncidentWasUpdatedEvent($this->auth->user(), $incident)); return $incident; } diff --git a/app/Bus/Handlers/Commands/IncidentUpdate/RemoveIncidentUpdateCommandHandler.php b/app/Bus/Handlers/Commands/IncidentUpdate/RemoveIncidentUpdateCommandHandler.php index 40bc6def6298..ee5cc5b7894e 100644 --- a/app/Bus/Handlers/Commands/IncidentUpdate/RemoveIncidentUpdateCommandHandler.php +++ b/app/Bus/Handlers/Commands/IncidentUpdate/RemoveIncidentUpdateCommandHandler.php @@ -13,6 +13,7 @@ use CachetHQ\Cachet\Bus\Commands\IncidentUpdate\RemoveIncidentUpdateCommand; use CachetHQ\Cachet\Bus\Events\IncidentUpdate\IncidentUpdateWasRemovedEvent; +use Illuminate\Contracts\Auth\Guard; /** * This is the remove incident update command handler. @@ -21,6 +22,25 @@ */ class RemoveIncidentUpdateCommandHandler { + /** + * The authentication guard instance. + * + * @var \Illuminate\Contracts\Auth\Guard + */ + protected $auth; + + /** + * Create a new remove incident update command handler instance. + * + * @param \Illuminate\Contracts\Auth\Guard $auth + * + * @return void + */ + public function __construct(Guard $auth) + { + $this->auth = $auth; + } + /** * Handle the remove incident update command. * @@ -32,7 +52,7 @@ public function handle(RemoveIncidentUpdateCommand $command) { $update = $command->incidentUpdate; - event(new IncidentUpdateWasRemovedEvent($update)); + event(new IncidentUpdateWasRemovedEvent($this->auth->user(), $update)); $update->delete(); } diff --git a/app/Bus/Handlers/Commands/IncidentUpdate/ReportIncidentUpdateCommandHandler.php b/app/Bus/Handlers/Commands/IncidentUpdate/ReportIncidentUpdateCommandHandler.php index 3ede0f6e73c9..fba3c3e53bff 100644 --- a/app/Bus/Handlers/Commands/IncidentUpdate/ReportIncidentUpdateCommandHandler.php +++ b/app/Bus/Handlers/Commands/IncidentUpdate/ReportIncidentUpdateCommandHandler.php @@ -15,6 +15,7 @@ use CachetHQ\Cachet\Bus\Commands\IncidentUpdate\ReportIncidentUpdateCommand; use CachetHQ\Cachet\Bus\Events\IncidentUpdate\IncidentUpdateWasReportedEvent; use CachetHQ\Cachet\Models\IncidentUpdate; +use Illuminate\Contracts\Auth\Guard; /** * This is the report incident update command handler. @@ -23,6 +24,25 @@ */ class ReportIncidentUpdateCommandHandler { + /** + * The authentication guard instance. + * + * @var \Illuminate\Contracts\Auth\Guard + */ + protected $auth; + + /** + * Create a new report incident update command handler instance. + * + * @param \Illuminate\Contracts\Auth\Guard $auth + * + * @return void + */ + public function __construct(Guard $auth) + { + $this->auth = $auth; + } + /** * Handle the report incident command. * @@ -58,7 +78,7 @@ public function handle(ReportIncidentUpdateCommand $command) [] )); - event(new IncidentUpdateWasReportedEvent($update)); + event(new IncidentUpdateWasReportedEvent($this->auth->user(), $update)); return $update; } diff --git a/app/Bus/Handlers/Commands/IncidentUpdate/UpdateIncidentUpdateCommandHandler.php b/app/Bus/Handlers/Commands/IncidentUpdate/UpdateIncidentUpdateCommandHandler.php index e65939803327..c3086ea7d747 100644 --- a/app/Bus/Handlers/Commands/IncidentUpdate/UpdateIncidentUpdateCommandHandler.php +++ b/app/Bus/Handlers/Commands/IncidentUpdate/UpdateIncidentUpdateCommandHandler.php @@ -13,6 +13,7 @@ use CachetHQ\Cachet\Bus\Commands\IncidentUpdate\UpdateIncidentUpdateCommand; use CachetHQ\Cachet\Bus\Events\IncidentUpdate\IncidentUpdateWasUpdatedEvent; +use Illuminate\Contracts\Auth\Guard; /** * This is the update incident update command handler. @@ -21,6 +22,25 @@ */ class UpdateIncidentUpdateCommandHandler { + /** + * The authentication guard instance. + * + * @var \Illuminate\Contracts\Auth\Guard + */ + protected $auth; + + /** + * Create a new update incident update command handler instance. + * + * @param \Illuminate\Contracts\Auth\Guard $auth + * + * @return void + */ + public function __construct(Guard $auth) + { + $this->auth = $auth; + } + /** * Handle the update incident update command. * @@ -32,7 +52,7 @@ public function handle(UpdateIncidentUpdateCommand $command) { $command->update->update($this->filter($command)); - event(new IncidentUpdateWasUpdatedEvent($command->update)); + event(new IncidentUpdateWasUpdatedEvent($this->auth->user(), $command->update)); return $command->update; } diff --git a/app/Bus/Handlers/Commands/Metric/AddMetricCommandHandler.php b/app/Bus/Handlers/Commands/Metric/AddMetricCommandHandler.php index 64291cc9c1d6..1f0744395fbb 100644 --- a/app/Bus/Handlers/Commands/Metric/AddMetricCommandHandler.php +++ b/app/Bus/Handlers/Commands/Metric/AddMetricCommandHandler.php @@ -14,9 +14,29 @@ use CachetHQ\Cachet\Bus\Commands\Metric\AddMetricCommand; use CachetHQ\Cachet\Bus\Events\Metric\MetricWasAddedEvent; use CachetHQ\Cachet\Models\Metric; +use Illuminate\Contracts\Auth\Guard; class AddMetricCommandHandler { + /** + * The authentication guard instance. + * + * @var \Illuminate\Contracts\Auth\Guard + */ + protected $auth; + + /** + * Create a new add metric command handler instance. + * + * @param \Illuminate\Contracts\Auth\Guard $auth + * + * @return void + */ + public function __construct(Guard $auth) + { + $this->auth = $auth; + } + /** * Handle the add metric command. * @@ -40,7 +60,7 @@ public function handle(AddMetricCommand $command) 'visible' => $command->visible, ]); - event(new MetricWasAddedEvent($metric)); + event(new MetricWasAddedEvent($this->auth->user(), $metric)); return $metric; } diff --git a/app/Bus/Handlers/Commands/Metric/AddMetricPointCommandHandler.php b/app/Bus/Handlers/Commands/Metric/AddMetricPointCommandHandler.php index 822cdc22bd6b..e76f74bcdf24 100644 --- a/app/Bus/Handlers/Commands/Metric/AddMetricPointCommandHandler.php +++ b/app/Bus/Handlers/Commands/Metric/AddMetricPointCommandHandler.php @@ -16,9 +16,17 @@ use CachetHQ\Cachet\Models\MetricPoint; use CachetHQ\Cachet\Services\Dates\DateFactory; use Carbon\Carbon; +use Illuminate\Contracts\Auth\Guard; class AddMetricPointCommandHandler { + /** + * The authentication guard instance. + * + * @var \Illuminate\Contracts\Auth\Guard + */ + protected $auth; + /** * The date factory instance. * @@ -29,12 +37,14 @@ class AddMetricPointCommandHandler /** * Create a new add metric point command handler instance. * + * @param \Illuminate\Contracts\Auth\Guard $auth * @param \CachetHQ\Cachet\Services\Dates\DateFactory $dates * * @return void */ - public function __construct(DateFactory $dates) + public function __construct(Guard $auth, DateFactory $dates) { + $this->auth = $auth; $this->dates = $dates; } @@ -55,7 +65,7 @@ public function handle(AddMetricPointCommand $command) $point->increment('counter', 1); - event(new MetricPointWasAddedEvent($point)); + event(new MetricPointWasAddedEvent($this->auth->user(), $point)); return $point; } diff --git a/app/Bus/Handlers/Commands/Metric/RemoveMetricCommandHandler.php b/app/Bus/Handlers/Commands/Metric/RemoveMetricCommandHandler.php index cd15e0ebf5de..478d29523bce 100644 --- a/app/Bus/Handlers/Commands/Metric/RemoveMetricCommandHandler.php +++ b/app/Bus/Handlers/Commands/Metric/RemoveMetricCommandHandler.php @@ -14,9 +14,29 @@ use CachetHQ\Cachet\Bus\Commands\Metric\RemoveMetricCommand; use CachetHQ\Cachet\Bus\Events\Metric\MetricWasRemovedEvent; use CachetHQ\Cachet\Models\Metric; +use Illuminate\Contracts\Auth\Guard; class RemoveMetricCommandHandler { + /** + * The authentication guard instance. + * + * @var \Illuminate\Contracts\Auth\Guard + */ + protected $auth; + + /** + * Create a new remove metric command handler instance. + * + * @param \Illuminate\Contracts\Auth\Guard $auth + * + * @return void + */ + public function __construct(Guard $auth) + { + $this->auth = $auth; + } + /** * Handle the remove metric command. * @@ -28,7 +48,7 @@ public function handle(RemoveMetricCommand $command) { $metric = $command->metric; - event(new MetricWasRemovedEvent($metric)); + event(new MetricWasRemovedEvent($this->auth->user(), $metric)); $metric->delete(); } diff --git a/app/Bus/Handlers/Commands/Metric/RemoveMetricPointCommandHandler.php b/app/Bus/Handlers/Commands/Metric/RemoveMetricPointCommandHandler.php index f7d6f6d7a26d..7679942ee5b5 100644 --- a/app/Bus/Handlers/Commands/Metric/RemoveMetricPointCommandHandler.php +++ b/app/Bus/Handlers/Commands/Metric/RemoveMetricPointCommandHandler.php @@ -14,9 +14,29 @@ use CachetHQ\Cachet\Bus\Commands\Metric\RemoveMetricPointCommand; use CachetHQ\Cachet\Bus\Events\Metric\MetricPointWasRemovedEvent; use CachetHQ\Cachet\Models\Metric; +use Illuminate\Contracts\Auth\Guard; class RemoveMetricPointCommandHandler { + /** + * The authentication guard instance. + * + * @var \Illuminate\Contracts\Auth\Guard + */ + protected $auth; + + /** + * Create a new remove metric point command handler instance. + * + * @param \Illuminate\Contracts\Auth\Guard $auth + * + * @return void + */ + public function __construct(Guard $auth) + { + $this->auth = $auth; + } + /** * Handle the remove metric point command. * @@ -28,7 +48,7 @@ public function handle(RemoveMetricPointCommand $command) { $metricPoint = $command->metricPoint; - event(new MetricPointWasRemovedEvent($metricPoint)); + event(new MetricPointWasRemovedEvent($this->auth->user(), $metricPoint)); $metricPoint->delete(); } diff --git a/app/Bus/Handlers/Commands/Metric/UpdateMetricCommandHandler.php b/app/Bus/Handlers/Commands/Metric/UpdateMetricCommandHandler.php index 0bfc29f5fde0..1ba3636be28d 100644 --- a/app/Bus/Handlers/Commands/Metric/UpdateMetricCommandHandler.php +++ b/app/Bus/Handlers/Commands/Metric/UpdateMetricCommandHandler.php @@ -14,9 +14,29 @@ use CachetHQ\Cachet\Bus\Commands\Metric\UpdateMetricCommand; use CachetHQ\Cachet\Bus\Events\Metric\MetricWasUpdatedEvent; use CachetHQ\Cachet\Models\Metric; +use Illuminate\Contracts\Auth\Guard; class UpdateMetricCommandHandler { + /** + * The authentication guard instance. + * + * @var \Illuminate\Contracts\Auth\Guard + */ + protected $auth; + + /** + * Create a new update metric command handler instance. + * + * @param \Illuminate\Contracts\Auth\Guard $auth + * + * @return void + */ + public function __construct(Guard $auth) + { + $this->auth = $auth; + } + /** * Handle the update metric command. * @@ -30,7 +50,7 @@ public function handle(UpdateMetricCommand $command) $metric->update($this->filter($command)); - event(new MetricWasUpdatedEvent($metric)); + event(new MetricWasUpdatedEvent($this->auth->user(), $metric)); return $metric; } diff --git a/app/Bus/Handlers/Commands/Metric/UpdateMetricPointCommandHandler.php b/app/Bus/Handlers/Commands/Metric/UpdateMetricPointCommandHandler.php index b75e5b1d2a55..0c5db2ee8b61 100644 --- a/app/Bus/Handlers/Commands/Metric/UpdateMetricPointCommandHandler.php +++ b/app/Bus/Handlers/Commands/Metric/UpdateMetricPointCommandHandler.php @@ -14,9 +14,17 @@ use CachetHQ\Cachet\Bus\Commands\Metric\UpdateMetricPointCommand; use CachetHQ\Cachet\Bus\Events\Metric\MetricPointWasUpdatedEvent; use CachetHQ\Cachet\Services\Dates\DateFactory; +use Illuminate\Contracts\Auth\Guard; class UpdateMetricPointCommandHandler { + /** + * The authentication guard instance. + * + * @var \Illuminate\Contracts\Auth\Guard + */ + protected $auth; + /** * The date factory instance. * @@ -27,12 +35,14 @@ class UpdateMetricPointCommandHandler /** * Create a new update metric point command handler instance. * + * @param \Illuminate\Contracts\Auth\Guard $auth * @param \CachetHQ\Cachet\Services\Dates\DateFactory $dates * * @return void */ - public function __construct(DateFactory $dates) + public function __construct(Guard $auth, DateFactory $dates) { + $this->auth = $auth; $this->dates = $dates; } @@ -60,7 +70,7 @@ public function handle(UpdateMetricPointCommand $command) $point->update($data); - event(new MetricPointWasUpdatedEvent($point)); + event(new MetricPointWasUpdatedEvent($this->auth->user(), $point)); return $point; } diff --git a/app/Bus/Handlers/Commands/Schedule/CreateScheduleCommandHandler.php b/app/Bus/Handlers/Commands/Schedule/CreateScheduleCommandHandler.php index b0462f3c8771..3450abdad3df 100644 --- a/app/Bus/Handlers/Commands/Schedule/CreateScheduleCommandHandler.php +++ b/app/Bus/Handlers/Commands/Schedule/CreateScheduleCommandHandler.php @@ -15,6 +15,7 @@ use CachetHQ\Cachet\Bus\Events\Schedule\ScheduleWasCreatedEvent; use CachetHQ\Cachet\Models\Schedule; use CachetHQ\Cachet\Services\Dates\DateFactory; +use Illuminate\Contracts\Auth\Guard; /** * This is the create schedule command handler. @@ -23,6 +24,13 @@ */ class CreateScheduleCommandHandler { + /** + * The authentication guard instance. + * + * @var \Illuminate\Contracts\Auth\Guard + */ + protected $auth; + /** * The date factory instance. * @@ -33,12 +41,14 @@ class CreateScheduleCommandHandler /** * Create a new update schedule command handler instance. * + * @param \Illuminate\Contracts\Auth\Guard $auth * @param \CachetHQ\Cachet\Services\Dates\DateFactory $dates * * @return void */ - public function __construct(DateFactory $dates) + public function __construct(Guard $auth, DateFactory $dates) { + $this->auth = $auth; $this->dates = $dates; } @@ -53,7 +63,7 @@ public function handle(CreateScheduleCommand $command) { $schedule = Schedule::create($this->filter($command)); - event(new ScheduleWasCreatedEvent($schedule)); + event(new ScheduleWasCreatedEvent($this->auth->user(), $schedule)); return $schedule; } diff --git a/app/Bus/Handlers/Commands/Schedule/DeleteScheduleCommandHandler.php b/app/Bus/Handlers/Commands/Schedule/DeleteScheduleCommandHandler.php index 0ceb5c064123..cf5f62278a54 100644 --- a/app/Bus/Handlers/Commands/Schedule/DeleteScheduleCommandHandler.php +++ b/app/Bus/Handlers/Commands/Schedule/DeleteScheduleCommandHandler.php @@ -13,6 +13,7 @@ use CachetHQ\Cachet\Bus\Commands\Schedule\DeleteScheduleCommand; use CachetHQ\Cachet\Bus\Events\Schedule\ScheduleWasRemovedEvent; +use Illuminate\Contracts\Auth\Guard; /** * This is the delete schedule command handler. @@ -21,6 +22,25 @@ */ class DeleteScheduleCommandHandler { + /** + * The authentication guard instance. + * + * @var \Illuminate\Contracts\Auth\Guard + */ + protected $auth; + + /** + * Create a new delete schedule command handler instance. + * + * @param \Illuminate\Contracts\Auth\Guard $auth + * + * @return void + */ + public function __construct(Guard $auth) + { + $this->auth = $auth; + } + /** * Handle the delete schedule command. * @@ -32,7 +52,7 @@ public function handle(DeleteScheduleCommand $command) { $schedule = $command->schedule; - event(new ScheduleWasRemovedEvent($schedule)); + event(new ScheduleWasRemovedEvent($this->auth->user(), $schedule)); $schedule->delete(); } diff --git a/app/Bus/Handlers/Commands/Schedule/UpdateScheduleCommandHandler.php b/app/Bus/Handlers/Commands/Schedule/UpdateScheduleCommandHandler.php index 98bbe348ab72..d4bf30b286f9 100644 --- a/app/Bus/Handlers/Commands/Schedule/UpdateScheduleCommandHandler.php +++ b/app/Bus/Handlers/Commands/Schedule/UpdateScheduleCommandHandler.php @@ -15,6 +15,7 @@ use CachetHQ\Cachet\Bus\Events\Schedule\ScheduleWasUpdatedEvent; use CachetHQ\Cachet\Models\Schedule; use CachetHQ\Cachet\Services\Dates\DateFactory; +use Illuminate\Contracts\Auth\Guard; /** * This is the update schedule command handler. @@ -23,6 +24,13 @@ */ class UpdateScheduleCommandHandler { + /** + * The authentication guard instance. + * + * @var \Illuminate\Contracts\Auth\Guard + */ + protected $auth; + /** * The date factory instance. * @@ -33,12 +41,14 @@ class UpdateScheduleCommandHandler /** * Create a new update schedule command handler instance. * + * @param \Illuminate\Contracts\Auth\Guard $auth * @param \CachetHQ\Cachet\Services\Dates\DateFactory $dates * * @return void */ - public function __construct(DateFactory $dates) + public function __construct(Guard $auth, DateFactory $dates) { + $this->auth = $auth; $this->dates = $dates; } @@ -55,7 +65,7 @@ public function handle(UpdateScheduleCommand $command) $schedule->update($this->filter($command)); - event(new ScheduleWasUpdatedEvent($schedule)); + event(new ScheduleWasUpdatedEvent($this->auth->user(), $schedule)); return $schedule; } diff --git a/app/Bus/Handlers/Events/ActionStorageHandler.php b/app/Bus/Handlers/Events/ActionStorageHandler.php new file mode 100644 index 000000000000..1d502d797758 --- /dev/null +++ b/app/Bus/Handlers/Events/ActionStorageHandler.php @@ -0,0 +1,49 @@ + + * @author James Brooks + */ +class ActionStorageHandler +{ + /** + * Handle the any actions that need storing. + * + * @param \CachetHQ\Cachet\Bus\Events\ActionInterface $event + * + * @return void + */ + public function handle(ActionInterface $event) + { + $data = $event->getAction(); + + $action = [ + 'class_name' => get_class($event), + 'user_id' => $data['user']->id, + 'username' => $data['user']->username, + 'description' => $data['description'], + ]; + + if ($data['information'] ?? null) { + $action['information'] = $data['information']; + } + + Action::create($action); + } +} diff --git a/app/Console/Commands/DemoSeederCommand.php b/app/Console/Commands/DemoSeederCommand.php index 221657e61950..ecddf5749d89 100644 --- a/app/Console/Commands/DemoSeederCommand.php +++ b/app/Console/Commands/DemoSeederCommand.php @@ -11,6 +11,7 @@ namespace CachetHQ\Cachet\Console\Commands; +use CachetHQ\Cachet\Models\Action; use CachetHQ\Cachet\Models\Component; use CachetHQ\Cachet\Models\ComponentGroup; use CachetHQ\Cachet\Models\Incident; @@ -84,6 +85,7 @@ public function fire() return; } + $this->seedActions(); $this->seedComponentGroups(); $this->seedComponents(); $this->seedIncidents(); @@ -98,6 +100,16 @@ public function fire() $this->info('Database seeded with demo data successfully!'); } + /** + * Seed the actions table. + * + * @return void + */ + protected function seedActions() + { + Action::truncate(); + } + /** * Seed the component groups table. * diff --git a/app/Foundation/Providers/EventServiceProvider.php b/app/Foundation/Providers/EventServiceProvider.php index 935b398c318b..941abb96e3f5 100644 --- a/app/Foundation/Providers/EventServiceProvider.php +++ b/app/Foundation/Providers/EventServiceProvider.php @@ -21,6 +21,9 @@ class EventServiceProvider extends ServiceProvider * @var array */ protected $listen = [ + 'CachetHQ\Cachet\Bus\Events\ActionInterface' => [ + 'CachetHQ\Cachet\Bus\Handlers\Events\ActionStorageHandler', + ], 'CachetHQ\Cachet\Bus\Events\Beacon\BeaconFailedToSendEvent' => [ 'CachetHQ\Cachet\Bus\Handlers\Events\Beacon\LogBeaconFailedHandler', ], diff --git a/app/Models/Action.php b/app/Models/Action.php new file mode 100644 index 000000000000..5ff0a3103e86 --- /dev/null +++ b/app/Models/Action.php @@ -0,0 +1,78 @@ + + * @author James Brooks + */ +class Action extends Model +{ + use ValidatingTrait; + + /** + * A list of methods protected from mass assignment. + * + * @var string[] + */ + protected $guarded = ['_token', '_method']; + + /** + * The relations to eager load on every query. + * + * @var string[] + */ + protected $with = ['user']; + + /** + * The attributes that should be casted to native types. + * + * @var string[] + */ + protected $casts = [ + 'id' => 'int', + 'class_name' => 'string', + 'user_id' => 'int', + 'username' => 'string', + 'information' => 'string', + 'description' => 'string', + ]; + + /** + * The validation rules. + * + * @var string[] + */ + public $rules = [ + 'id' => 'nullable|int|min:1', + 'class_name' => 'required|string', + 'user_id' => 'required|int|min:1', + 'username' => 'required|string', + 'information' => 'nullable|string', + 'description' => 'required|string', + ]; + + /** + * Get the user relation. + * + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function user() + { + return $this->belongsTo(User::class); + } +} diff --git a/database/migrations/2017_02_03_222218_CreateActionsTable.php b/database/migrations/2017_02_03_222218_CreateActionsTable.php new file mode 100644 index 000000000000..7c535b18475e --- /dev/null +++ b/database/migrations/2017_02_03_222218_CreateActionsTable.php @@ -0,0 +1,45 @@ +increments('id'); + $table->string('class_name'); + $table->bigInteger('user_id')->unsigned()->index(); + $table->string('username'); + $table->string('information')->nullable(); + $table->string('description'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('actions'); + } +} diff --git a/tests/Bus/Events/Component/ComponentStatusWasUpdatedEventTest.php b/tests/Bus/Events/Component/ComponentStatusWasUpdatedEventTest.php index 8263b166d147..e59bcfce921b 100644 --- a/tests/Bus/Events/Component/ComponentStatusWasUpdatedEventTest.php +++ b/tests/Bus/Events/Component/ComponentStatusWasUpdatedEventTest.php @@ -13,6 +13,7 @@ use CachetHQ\Cachet\Bus\Events\Component\ComponentStatusWasUpdatedEvent; use CachetHQ\Cachet\Models\Component; +use CachetHQ\Cachet\Models\User; use Illuminate\Foundation\Testing\DatabaseMigrations; use MailThief\Testing\InteractsWithMail; @@ -27,6 +28,8 @@ class ComponentStatusWasUpdatedEventTest extends AbstractComponentEventTestCase public function testComponentUpdateEmailWasSent() { + $user = factory('CachetHQ\Cachet\Models\User')->create(); + $component = factory('CachetHQ\Cachet\Models\Component')->create([ 'status' => 2, ]); @@ -37,7 +40,7 @@ public function testComponentUpdateEmailWasSent() $subscriber->subscriptions()->create(['component_id' => $component->id]); - $this->app['events']->fire(new ComponentStatusWasUpdatedEvent($component, 1, 2)); + $this->app['events']->fire(new ComponentStatusWasUpdatedEvent($user, $component, 1, 2)); $this->seeMessageFor($subscriber->email); $this->seeMessageWithSubject(trans('notifications.component.status_update.mail.subject')); @@ -55,8 +58,13 @@ protected function objectHasHandlers() protected function getObjectAndParams() { - $params = ['component' => new Component(), 'original_status' => 1, 'new_status' => 2]; - $object = new ComponentStatusWasUpdatedEvent($params['component'], $params['original_status'], $params['new_status']); + $params = ['user' => new User(), 'component' => new Component(), 'original_status' => 1, 'new_status' => 2]; + $object = new ComponentStatusWasUpdatedEvent( + $params['user'], + $params['component'], + $params['original_status'], + $params['new_status'] + ); return compact('params', 'object'); } diff --git a/tests/Bus/Events/Component/ComponentWasAddedEventTest.php b/tests/Bus/Events/Component/ComponentWasAddedEventTest.php index 1584669268c2..ac9c9857f7b3 100644 --- a/tests/Bus/Events/Component/ComponentWasAddedEventTest.php +++ b/tests/Bus/Events/Component/ComponentWasAddedEventTest.php @@ -13,6 +13,7 @@ use CachetHQ\Cachet\Bus\Events\Component\ComponentWasAddedEvent; use CachetHQ\Cachet\Models\Component; +use CachetHQ\Cachet\Models\User; class ComponentWasAddedEventTest extends AbstractComponentEventTestCase { @@ -23,8 +24,8 @@ protected function objectHasHandlers() protected function getObjectAndParams() { - $params = ['component' => new Component()]; - $object = new ComponentWasAddedEvent($params['component']); + $params = ['user' => new User(), 'component' => new Component()]; + $object = new ComponentWasAddedEvent($params['user'], $params['component']); return compact('params', 'object'); } diff --git a/tests/Bus/Events/Component/ComponentWasRemovedEventTest.php b/tests/Bus/Events/Component/ComponentWasRemovedEventTest.php index 642a98b13c5c..d70b30f762ef 100644 --- a/tests/Bus/Events/Component/ComponentWasRemovedEventTest.php +++ b/tests/Bus/Events/Component/ComponentWasRemovedEventTest.php @@ -13,6 +13,7 @@ use CachetHQ\Cachet\Bus\Events\Component\ComponentWasRemovedEvent; use CachetHQ\Cachet\Models\Component; +use CachetHQ\Cachet\Models\User; class ComponentWasRemovedEventTest extends AbstractComponentEventTestCase { @@ -23,8 +24,8 @@ protected function objectHasHandlers() protected function getObjectAndParams() { - $params = ['component' => new Component()]; - $object = new ComponentWasRemovedEvent($params['component']); + $params = ['user' => new User(), 'component' => new Component()]; + $object = new ComponentWasRemovedEvent($params['user'], $params['component']); return compact('params', 'object'); } diff --git a/tests/Bus/Events/Component/ComponentWasUpdatedEventTest.php b/tests/Bus/Events/Component/ComponentWasUpdatedEventTest.php index 54d6a0fdf310..7555fdae7d85 100644 --- a/tests/Bus/Events/Component/ComponentWasUpdatedEventTest.php +++ b/tests/Bus/Events/Component/ComponentWasUpdatedEventTest.php @@ -13,6 +13,7 @@ use CachetHQ\Cachet\Bus\Events\Component\ComponentWasUpdatedEvent; use CachetHQ\Cachet\Models\Component; +use CachetHQ\Cachet\Models\User; class ComponentWasUpdatedEventTest extends AbstractComponentEventTestCase { @@ -23,8 +24,8 @@ protected function objectHasHandlers() protected function getObjectAndParams() { - $params = ['component' => new Component()]; - $object = new ComponentWasUpdatedEvent($params['component']); + $params = ['user' => new User(), 'component' => new Component()]; + $object = new ComponentWasUpdatedEvent($params['user'], $params['component']); return compact('params', 'object'); } diff --git a/tests/Bus/Events/ComponentGroup/ComponentGroupWasAddedEventTest.php b/tests/Bus/Events/ComponentGroup/ComponentGroupWasAddedEventTest.php index 91ba5e2d1de0..c8a01f89e3ae 100644 --- a/tests/Bus/Events/ComponentGroup/ComponentGroupWasAddedEventTest.php +++ b/tests/Bus/Events/ComponentGroup/ComponentGroupWasAddedEventTest.php @@ -13,6 +13,7 @@ use CachetHQ\Cachet\Bus\Events\ComponentGroup\ComponentGroupWasAddedEvent; use CachetHQ\Cachet\Models\ComponentGroup; +use CachetHQ\Cachet\Models\User; class ComponentGroupWasAddedEventTest extends AbstractComponentGroupEventTestCase { @@ -23,8 +24,8 @@ protected function objectHasHandlers() protected function getObjectAndParams() { - $params = ['group' => new ComponentGroup()]; - $object = new ComponentGroupWasAddedEvent($params['group']); + $params = ['user' => new User(), 'group' => new ComponentGroup()]; + $object = new ComponentGroupWasAddedEvent($params['user'], $params['group']); return compact('params', 'object'); } diff --git a/tests/Bus/Events/ComponentGroup/ComponentGroupWasRemovedEventTest.php b/tests/Bus/Events/ComponentGroup/ComponentGroupWasRemovedEventTest.php index c96aaf50717b..1a9903e43a7c 100644 --- a/tests/Bus/Events/ComponentGroup/ComponentGroupWasRemovedEventTest.php +++ b/tests/Bus/Events/ComponentGroup/ComponentGroupWasRemovedEventTest.php @@ -13,6 +13,7 @@ use CachetHQ\Cachet\Bus\Events\ComponentGroup\ComponentGroupWasRemovedEvent; use CachetHQ\Cachet\Models\ComponentGroup; +use CachetHQ\Cachet\Models\User; class ComponentGroupWasRemovedEventTest extends AbstractComponentGroupEventTestCase { @@ -23,8 +24,8 @@ protected function objectHasHandlers() protected function getObjectAndParams() { - $params = ['group' => new ComponentGroup()]; - $object = new ComponentGroupWasRemovedEvent($params['group']); + $params = ['user' => new User(), 'group' => new ComponentGroup()]; + $object = new ComponentGroupWasRemovedEvent($params['user'], $params['group']); return compact('params', 'object'); } diff --git a/tests/Bus/Events/ComponentGroup/ComponentGroupWasUpdatedEventTest.php b/tests/Bus/Events/ComponentGroup/ComponentGroupWasUpdatedEventTest.php index 6b28bcb9756d..e1be2705e0b6 100644 --- a/tests/Bus/Events/ComponentGroup/ComponentGroupWasUpdatedEventTest.php +++ b/tests/Bus/Events/ComponentGroup/ComponentGroupWasUpdatedEventTest.php @@ -13,6 +13,7 @@ use CachetHQ\Cachet\Bus\Events\ComponentGroup\ComponentGroupWasUpdatedEvent; use CachetHQ\Cachet\Models\ComponentGroup; +use CachetHQ\Cachet\Models\User; class ComponentGroupWasUpdatedEventTest extends AbstractComponentGroupEventTestCase { @@ -23,8 +24,8 @@ protected function objectHasHandlers() protected function getObjectAndParams() { - $params = ['group' => new ComponentGroup()]; - $object = new ComponentGroupWasUpdatedEvent($params['group']); + $params = ['user' => new User(), 'group' => new ComponentGroup()]; + $object = new ComponentGroupWasUpdatedEvent($params['user'], $params['group']); return compact('params', 'object'); } diff --git a/tests/Bus/Events/Incident/IncidentWasRemovedEventTest.php b/tests/Bus/Events/Incident/IncidentWasRemovedEventTest.php index aadb73985816..63ff848c729d 100644 --- a/tests/Bus/Events/Incident/IncidentWasRemovedEventTest.php +++ b/tests/Bus/Events/Incident/IncidentWasRemovedEventTest.php @@ -13,6 +13,7 @@ use CachetHQ\Cachet\Bus\Events\Incident\IncidentWasRemovedEvent; use CachetHQ\Cachet\Models\Incident; +use CachetHQ\Cachet\Models\User; /** * This is the incident was removed event test class. @@ -28,8 +29,8 @@ protected function objectHasHandlers() protected function getObjectAndParams() { - $params = ['incident' => new Incident()]; - $object = new IncidentWasRemovedEvent($params['incident']); + $params = ['user' => new User(), 'incident' => new Incident()]; + $object = new IncidentWasRemovedEvent($params['user'], $params['incident']); return compact('params', 'object'); } diff --git a/tests/Bus/Events/Incident/IncidentWasReportedEventTest.php b/tests/Bus/Events/Incident/IncidentWasReportedEventTest.php index b556351285f8..cb4445d95a80 100644 --- a/tests/Bus/Events/Incident/IncidentWasReportedEventTest.php +++ b/tests/Bus/Events/Incident/IncidentWasReportedEventTest.php @@ -13,6 +13,7 @@ use CachetHQ\Cachet\Bus\Events\Incident\IncidentWasReportedEvent; use CachetHQ\Cachet\Models\Incident; +use CachetHQ\Cachet\Models\User; /** * This is the incident was reported event test class. @@ -29,10 +30,11 @@ protected function objectHasHandlers() protected function getObjectAndParams() { $params = [ + 'user' => new User(), 'incident' => new Incident(), 'notify' => true, ]; - $object = new IncidentWasReportedEvent($params['incident'], $params['notify']); + $object = new IncidentWasReportedEvent($params['user'], $params['incident'], $params['notify']); return compact('params', 'object'); } diff --git a/tests/Bus/Events/Incident/IncidentWasUpdatedEventTest.php b/tests/Bus/Events/Incident/IncidentWasUpdatedEventTest.php index 732de05c6f30..7fb95637f0d1 100644 --- a/tests/Bus/Events/Incident/IncidentWasUpdatedEventTest.php +++ b/tests/Bus/Events/Incident/IncidentWasUpdatedEventTest.php @@ -13,6 +13,7 @@ use CachetHQ\Cachet\Bus\Events\Incident\IncidentWasUpdatedEvent; use CachetHQ\Cachet\Models\Incident; +use CachetHQ\Cachet\Models\User; /** * This is the incident was updated event test class. @@ -28,8 +29,8 @@ protected function objectHasHandlers() protected function getObjectAndParams() { - $params = ['incident' => new Incident()]; - $object = new IncidentWasUpdatedEvent($params['incident']); + $params = ['user' => new User(), 'incident' => new Incident()]; + $object = new IncidentWasUpdatedEvent($params['user'], $params['incident']); return compact('params', 'object'); } diff --git a/tests/Bus/Events/IncidentUpdate/IncidentUpdateWasRemovedEventTest.php b/tests/Bus/Events/IncidentUpdate/IncidentUpdateWasRemovedEventTest.php index cdc04296f0ae..faac63768b9a 100644 --- a/tests/Bus/Events/IncidentUpdate/IncidentUpdateWasRemovedEventTest.php +++ b/tests/Bus/Events/IncidentUpdate/IncidentUpdateWasRemovedEventTest.php @@ -13,6 +13,7 @@ use CachetHQ\Cachet\Bus\Events\IncidentUpdate\IncidentUpdateWasRemovedEvent; use CachetHQ\Cachet\Models\IncidentUpdate; +use CachetHQ\Cachet\Models\User; class IncidentUpdateWasRemovedEventTest extends AbstractIncidentUpdateEventTestCase { @@ -23,8 +24,8 @@ protected function objectHasHandlers() protected function getObjectAndParams() { - $params = ['update' => new IncidentUpdate()]; - $object = new IncidentUpdateWasRemovedEvent($params['update']); + $params = ['user' => new User(), 'update' => new IncidentUpdate()]; + $object = new IncidentUpdateWasRemovedEvent($params['user'], $params['update']); return compact('params', 'object'); } diff --git a/tests/Bus/Events/IncidentUpdate/IncidentUpdateWasReportedEventTest.php b/tests/Bus/Events/IncidentUpdate/IncidentUpdateWasReportedEventTest.php index 971cc2b6cd79..cd4369921ad0 100644 --- a/tests/Bus/Events/IncidentUpdate/IncidentUpdateWasReportedEventTest.php +++ b/tests/Bus/Events/IncidentUpdate/IncidentUpdateWasReportedEventTest.php @@ -13,6 +13,7 @@ use CachetHQ\Cachet\Bus\Events\IncidentUpdate\IncidentUpdateWasReportedEvent; use CachetHQ\Cachet\Models\IncidentUpdate; +use CachetHQ\Cachet\Models\User; class IncidentUpdateWasReportedEventTest extends AbstractIncidentUpdateEventTestCase { @@ -23,8 +24,8 @@ protected function objectHasHandlers() protected function getObjectAndParams() { - $params = ['update' => new IncidentUpdate()]; - $object = new IncidentUpdateWasReportedEvent($params['update']); + $params = ['user' => new User(), 'update' => new IncidentUpdate()]; + $object = new IncidentUpdateWasReportedEvent($params['user'], $params['update']); return compact('params', 'object'); } diff --git a/tests/Bus/Events/IncidentUpdate/IncidentUpdateWasUpdatedEventTest.php b/tests/Bus/Events/IncidentUpdate/IncidentUpdateWasUpdatedEventTest.php index c576beeb9435..36b45683c58e 100644 --- a/tests/Bus/Events/IncidentUpdate/IncidentUpdateWasUpdatedEventTest.php +++ b/tests/Bus/Events/IncidentUpdate/IncidentUpdateWasUpdatedEventTest.php @@ -13,6 +13,7 @@ use CachetHQ\Cachet\Bus\Events\IncidentUpdate\IncidentUpdateWasUpdatedEvent; use CachetHQ\Cachet\Models\IncidentUpdate; +use CachetHQ\Cachet\Models\User; class IncidentUpdateWasUpdatedEventTest extends AbstractIncidentUpdateEventTestCase { @@ -23,8 +24,8 @@ protected function objectHasHandlers() protected function getObjectAndParams() { - $params = ['update' => new IncidentUpdate()]; - $object = new IncidentUpdateWasUpdatedEvent($params['update']); + $params = ['user' => new User(), 'update' => new IncidentUpdate()]; + $object = new IncidentUpdateWasUpdatedEvent($params['user'], $params['update']); return compact('params', 'object'); } diff --git a/tests/Bus/Events/Metric/MetricPointWasAddedEventTest.php b/tests/Bus/Events/Metric/MetricPointWasAddedEventTest.php index 99fe8be33593..770da8da55ac 100644 --- a/tests/Bus/Events/Metric/MetricPointWasAddedEventTest.php +++ b/tests/Bus/Events/Metric/MetricPointWasAddedEventTest.php @@ -13,6 +13,7 @@ use CachetHQ\Cachet\Bus\Events\Metric\MetricPointWasAddedEvent; use CachetHQ\Cachet\Models\MetricPoint; +use CachetHQ\Cachet\Models\User; /** * This is the metric point was added event test class. @@ -28,8 +29,8 @@ protected function objectHasHandlers() protected function getObjectAndParams() { - $params = ['metricPoint' => new MetricPoint()]; - $object = new MetricPointWasAddedEvent($params['metricPoint']); + $params = ['user' => new User(), 'metricPoint' => new MetricPoint()]; + $object = new MetricPointWasAddedEvent($params['user'], $params['metricPoint']); return compact('params', 'object'); } diff --git a/tests/Bus/Events/Metric/MetricPointWasRemovedEventTest.php b/tests/Bus/Events/Metric/MetricPointWasRemovedEventTest.php index 4c2a8c4f2ee2..f55ee3cd4621 100644 --- a/tests/Bus/Events/Metric/MetricPointWasRemovedEventTest.php +++ b/tests/Bus/Events/Metric/MetricPointWasRemovedEventTest.php @@ -13,6 +13,7 @@ use CachetHQ\Cachet\Bus\Events\Metric\MetricPointWasRemovedEvent; use CachetHQ\Cachet\Models\MetricPoint; +use CachetHQ\Cachet\Models\User; /** * This is the metric point was removed event test class. @@ -28,8 +29,8 @@ protected function objectHasHandlers() protected function getObjectAndParams() { - $params = ['metricPoint' => new MetricPoint()]; - $object = new MetricPointWasRemovedEvent($params['metricPoint']); + $params = ['user' => new User(), 'metricPoint' => new MetricPoint()]; + $object = new MetricPointWasRemovedEvent($params['user'], $params['metricPoint']); return compact('params', 'object'); } diff --git a/tests/Bus/Events/Metric/MetricPointWasUpdatedEventTest.php b/tests/Bus/Events/Metric/MetricPointWasUpdatedEventTest.php index fd5b30997c40..4f411dd68186 100644 --- a/tests/Bus/Events/Metric/MetricPointWasUpdatedEventTest.php +++ b/tests/Bus/Events/Metric/MetricPointWasUpdatedEventTest.php @@ -13,6 +13,7 @@ use CachetHQ\Cachet\Bus\Events\Metric\MetricPointWasUpdatedEvent; use CachetHQ\Cachet\Models\MetricPoint; +use CachetHQ\Cachet\Models\User; /** * This is the metric point was updated event test class. @@ -28,8 +29,8 @@ protected function objectHasHandlers() protected function getObjectAndParams() { - $params = ['metricPoint' => new MetricPoint()]; - $object = new MetricPointWasUpdatedEvent($params['metricPoint']); + $params = ['user' => new User(), 'metricPoint' => new MetricPoint()]; + $object = new MetricPointWasUpdatedEvent($params['user'], $params['metricPoint']); return compact('params', 'object'); } diff --git a/tests/Bus/Events/Metric/MetricWasAddedEventTest.php b/tests/Bus/Events/Metric/MetricWasAddedEventTest.php index 63da8cfc304b..65b18a74fd20 100644 --- a/tests/Bus/Events/Metric/MetricWasAddedEventTest.php +++ b/tests/Bus/Events/Metric/MetricWasAddedEventTest.php @@ -13,6 +13,7 @@ use CachetHQ\Cachet\Bus\Events\Metric\MetricWasAddedEvent; use CachetHQ\Cachet\Models\Metric; +use CachetHQ\Cachet\Models\User; class MetricWasAddedEventTest extends AbstractMetricEventTestCase { @@ -23,8 +24,8 @@ protected function objectHasHandlers() protected function getObjectAndParams() { - $params = ['metric' => new Metric()]; - $object = new MetricWasAddedEvent($params['metric']); + $params = ['user' => new User(), 'metric' => new Metric()]; + $object = new MetricWasAddedEvent($params['user'], $params['metric']); return compact('params', 'object'); } diff --git a/tests/Bus/Events/Metric/MetricWasRemovedEventTest.php b/tests/Bus/Events/Metric/MetricWasRemovedEventTest.php index a5aa90d14ee5..3759ee05e6c6 100644 --- a/tests/Bus/Events/Metric/MetricWasRemovedEventTest.php +++ b/tests/Bus/Events/Metric/MetricWasRemovedEventTest.php @@ -13,6 +13,7 @@ use CachetHQ\Cachet\Bus\Events\Metric\MetricWasRemovedEvent; use CachetHQ\Cachet\Models\Metric; +use CachetHQ\Cachet\Models\User; class MetricWasRemovedEventTest extends AbstractMetricEventTestCase { @@ -23,8 +24,8 @@ protected function objectHasHandlers() protected function getObjectAndParams() { - $params = ['metric' => new Metric()]; - $object = new MetricWasRemovedEvent($params['metric']); + $params = ['user' => new User(), 'metric' => new Metric()]; + $object = new MetricWasRemovedEvent($params['user'], $params['metric']); return compact('params', 'object'); } diff --git a/tests/Bus/Events/Metric/MetricWasUpdatedEventTest.php b/tests/Bus/Events/Metric/MetricWasUpdatedEventTest.php index 8f8cba556f4b..0e6cbc4eb763 100644 --- a/tests/Bus/Events/Metric/MetricWasUpdatedEventTest.php +++ b/tests/Bus/Events/Metric/MetricWasUpdatedEventTest.php @@ -13,6 +13,7 @@ use CachetHQ\Cachet\Bus\Events\Metric\MetricWasUpdatedEvent; use CachetHQ\Cachet\Models\Metric; +use CachetHQ\Cachet\Models\User; class MetricWasUpdatedEventTest extends AbstractMetricEventTestCase { @@ -23,8 +24,8 @@ protected function objectHasHandlers() protected function getObjectAndParams() { - $params = ['metric' => new Metric()]; - $object = new MetricWasUpdatedEvent($params['metric']); + $params = ['user' => new User(), 'metric' => new Metric()]; + $object = new MetricWasUpdatedEvent($params['user'], $params['metric']); return compact('params', 'object'); } diff --git a/tests/Bus/Events/Schedule/ScheduleWasCreatedEventTest.php b/tests/Bus/Events/Schedule/ScheduleWasCreatedEventTest.php index 635daf67cf68..9f1d41966ebb 100644 --- a/tests/Bus/Events/Schedule/ScheduleWasCreatedEventTest.php +++ b/tests/Bus/Events/Schedule/ScheduleWasCreatedEventTest.php @@ -13,6 +13,7 @@ use CachetHQ\Cachet\Bus\Events\Schedule\ScheduleWasCreatedEvent; use CachetHQ\Cachet\Models\Schedule; +use CachetHQ\Cachet\Models\User; class ScheduleWasCreatedEventTest extends AbstractScheduleEventTestCase { @@ -23,8 +24,8 @@ protected function objectHasHandlers() protected function getObjectAndParams() { - $params = ['schedule' => new Schedule()]; - $object = new ScheduleWasCreatedEvent($params['schedule']); + $params = ['user' => new User(), 'schedule' => new Schedule()]; + $object = new ScheduleWasCreatedEvent($params['user'], $params['schedule']); return compact('params', 'object'); } diff --git a/tests/Bus/Events/Schedule/ScheduleWasRemovedEventTest.php b/tests/Bus/Events/Schedule/ScheduleWasRemovedEventTest.php index 2989e27f0e3a..112828852993 100644 --- a/tests/Bus/Events/Schedule/ScheduleWasRemovedEventTest.php +++ b/tests/Bus/Events/Schedule/ScheduleWasRemovedEventTest.php @@ -13,6 +13,7 @@ use CachetHQ\Cachet\Bus\Events\Schedule\ScheduleWasRemovedEvent; use CachetHQ\Cachet\Models\Schedule; +use CachetHQ\Cachet\Models\User; class ScheduleWasRemovedEventTest extends AbstractScheduleEventTestCase { @@ -23,8 +24,8 @@ protected function objectHasHandlers() protected function getObjectAndParams() { - $params = ['schedule' => new Schedule()]; - $object = new ScheduleWasRemovedEvent($params['schedule']); + $params = ['user' => new User(), 'schedule' => new Schedule()]; + $object = new ScheduleWasRemovedEvent($params['user'], $params['schedule']); return compact('params', 'object'); } diff --git a/tests/Bus/Events/Schedule/ScheduleWasUpdatedEventTest.php b/tests/Bus/Events/Schedule/ScheduleWasUpdatedEventTest.php index 75604788c173..ec5f8df4564b 100644 --- a/tests/Bus/Events/Schedule/ScheduleWasUpdatedEventTest.php +++ b/tests/Bus/Events/Schedule/ScheduleWasUpdatedEventTest.php @@ -13,6 +13,7 @@ use CachetHQ\Cachet\Bus\Events\Schedule\ScheduleWasUpdatedEvent; use CachetHQ\Cachet\Models\Schedule; +use CachetHQ\Cachet\Models\User; class ScheduleWasUpdatedEventTest extends AbstractScheduleEventTestCase { @@ -23,8 +24,8 @@ protected function objectHasHandlers() protected function getObjectAndParams() { - $params = ['schedule' => new Schedule()]; - $object = new ScheduleWasUpdatedEvent($params['schedule']); + $params = ['user' => new User(), 'schedule' => new Schedule()]; + $object = new ScheduleWasUpdatedEvent($params['user'], $params['schedule']); return compact('params', 'object'); } diff --git a/tests/Models/ActionTest.php b/tests/Models/ActionTest.php new file mode 100644 index 000000000000..cda704ab24d9 --- /dev/null +++ b/tests/Models/ActionTest.php @@ -0,0 +1,31 @@ + + */ +class ActionTest extends AbstractTestCase +{ + use ValidationTrait; + + public function testValidation() + { + $this->checkRules(new Action()); + } +} From a1a00d07bcfe9f9073fd6068af8f7b73b3e97c85 Mon Sep 17 00:00:00 2001 From: James Brooks Date: Sat, 4 Feb 2017 16:54:39 +0000 Subject: [PATCH 2/2] Apply fixes from StyleCI [ci skip] [skip ci] --- .../Handlers/Commands/Incident/ReportIncidentCommandHandler.php | 2 +- .../Handlers/Commands/Incident/UpdateIncidentCommandHandler.php | 2 +- .../Handlers/Commands/Metric/AddMetricPointCommandHandler.php | 2 +- .../Commands/Metric/UpdateMetricPointCommandHandler.php | 2 +- .../Handlers/Commands/Schedule/CreateScheduleCommandHandler.php | 2 +- .../Handlers/Commands/Schedule/UpdateScheduleCommandHandler.php | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/Bus/Handlers/Commands/Incident/ReportIncidentCommandHandler.php b/app/Bus/Handlers/Commands/Incident/ReportIncidentCommandHandler.php index 7ee9be7005a0..445b295b7c94 100644 --- a/app/Bus/Handlers/Commands/Incident/ReportIncidentCommandHandler.php +++ b/app/Bus/Handlers/Commands/Incident/ReportIncidentCommandHandler.php @@ -48,7 +48,7 @@ class ReportIncidentCommandHandler /** * Create a new report incident command handler instance. * - * @param \Illuminate\Contracts\Auth\Guard $auth + * @param \Illuminate\Contracts\Auth\Guard $auth * @param \CachetHQ\Cachet\Services\Dates\DateFactory $dates * * @return void diff --git a/app/Bus/Handlers/Commands/Incident/UpdateIncidentCommandHandler.php b/app/Bus/Handlers/Commands/Incident/UpdateIncidentCommandHandler.php index 555ec22f8bfa..ac281c0eef21 100644 --- a/app/Bus/Handlers/Commands/Incident/UpdateIncidentCommandHandler.php +++ b/app/Bus/Handlers/Commands/Incident/UpdateIncidentCommandHandler.php @@ -47,7 +47,7 @@ class UpdateIncidentCommandHandler /** * Create a new update incident command handler instance. * - * @param \Illuminate\Contracts\Auth\Guard $auth + * @param \Illuminate\Contracts\Auth\Guard $auth * @param \CachetHQ\Cachet\Services\Dates\DateFactory $dates * * @return void diff --git a/app/Bus/Handlers/Commands/Metric/AddMetricPointCommandHandler.php b/app/Bus/Handlers/Commands/Metric/AddMetricPointCommandHandler.php index e76f74bcdf24..5be8acb1616b 100644 --- a/app/Bus/Handlers/Commands/Metric/AddMetricPointCommandHandler.php +++ b/app/Bus/Handlers/Commands/Metric/AddMetricPointCommandHandler.php @@ -37,7 +37,7 @@ class AddMetricPointCommandHandler /** * Create a new add metric point command handler instance. * - * @param \Illuminate\Contracts\Auth\Guard $auth + * @param \Illuminate\Contracts\Auth\Guard $auth * @param \CachetHQ\Cachet\Services\Dates\DateFactory $dates * * @return void diff --git a/app/Bus/Handlers/Commands/Metric/UpdateMetricPointCommandHandler.php b/app/Bus/Handlers/Commands/Metric/UpdateMetricPointCommandHandler.php index 0c5db2ee8b61..f61e1733375e 100644 --- a/app/Bus/Handlers/Commands/Metric/UpdateMetricPointCommandHandler.php +++ b/app/Bus/Handlers/Commands/Metric/UpdateMetricPointCommandHandler.php @@ -35,7 +35,7 @@ class UpdateMetricPointCommandHandler /** * Create a new update metric point command handler instance. * - * @param \Illuminate\Contracts\Auth\Guard $auth + * @param \Illuminate\Contracts\Auth\Guard $auth * @param \CachetHQ\Cachet\Services\Dates\DateFactory $dates * * @return void diff --git a/app/Bus/Handlers/Commands/Schedule/CreateScheduleCommandHandler.php b/app/Bus/Handlers/Commands/Schedule/CreateScheduleCommandHandler.php index 3450abdad3df..403131a25563 100644 --- a/app/Bus/Handlers/Commands/Schedule/CreateScheduleCommandHandler.php +++ b/app/Bus/Handlers/Commands/Schedule/CreateScheduleCommandHandler.php @@ -41,7 +41,7 @@ class CreateScheduleCommandHandler /** * Create a new update schedule command handler instance. * - * @param \Illuminate\Contracts\Auth\Guard $auth + * @param \Illuminate\Contracts\Auth\Guard $auth * @param \CachetHQ\Cachet\Services\Dates\DateFactory $dates * * @return void diff --git a/app/Bus/Handlers/Commands/Schedule/UpdateScheduleCommandHandler.php b/app/Bus/Handlers/Commands/Schedule/UpdateScheduleCommandHandler.php index d4bf30b286f9..72f743280104 100644 --- a/app/Bus/Handlers/Commands/Schedule/UpdateScheduleCommandHandler.php +++ b/app/Bus/Handlers/Commands/Schedule/UpdateScheduleCommandHandler.php @@ -41,7 +41,7 @@ class UpdateScheduleCommandHandler /** * Create a new update schedule command handler instance. * - * @param \Illuminate\Contracts\Auth\Guard $auth + * @param \Illuminate\Contracts\Auth\Guard $auth * @param \CachetHQ\Cachet\Services\Dates\DateFactory $dates * * @return void