-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2142 from CachetHQ/incident-updates
Incident updates
- Loading branch information
Showing
43 changed files
with
1,834 additions
and
85 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
app/Bus/Commands/IncidentUpdate/RemoveIncidentUpdateCommand.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of Cachet. | ||
* | ||
* (c) Alt Three Services Limited | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace CachetHQ\Cachet\Bus\Commands\IncidentUpdate; | ||
|
||
use CachetHQ\Cachet\Models\IncidentUpdate; | ||
|
||
/** | ||
* This is the remove incident update command. | ||
* | ||
* @author James Brooks <james@alt-three.com> | ||
*/ | ||
final class RemoveIncidentUpdateCommand | ||
{ | ||
/** | ||
* The incident update to remove. | ||
* | ||
* @var \CachetHQ\Cachet\Models\IncidentUpdate | ||
*/ | ||
public $incidentUpdate; | ||
|
||
/** | ||
* Create a new remove incident update command instance. | ||
* | ||
* @param \CachetHQ\Cachet\Models\IncidentUpdate $incidentUpdate | ||
* | ||
* @return void | ||
*/ | ||
public function __construct(IncidentUpdate $incidentUpdate) | ||
{ | ||
$this->incidentUpdate = $incidentUpdate; | ||
} | ||
} |
81 changes: 81 additions & 0 deletions
81
app/Bus/Commands/IncidentUpdate/ReportIncidentUpdateCommand.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of Cachet. | ||
* | ||
* (c) Alt Three Services Limited | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace CachetHQ\Cachet\Bus\Commands\IncidentUpdate; | ||
|
||
use CachetHQ\Cachet\Models\Incident; | ||
use CachetHQ\Cachet\Models\User; | ||
|
||
/** | ||
* This is the report incident update command. | ||
* | ||
* @author James Brooks <james@alt-three.com> | ||
*/ | ||
final class ReportIncidentUpdateCommand | ||
{ | ||
/** | ||
* The incident. | ||
* | ||
* @var \CachetHQ\Cachet\Models\Incident | ||
*/ | ||
public $incident; | ||
|
||
/** | ||
* The incident status. | ||
* | ||
* @var int | ||
*/ | ||
public $status; | ||
|
||
/** | ||
* The incident message. | ||
* | ||
* @var string | ||
*/ | ||
public $message; | ||
|
||
/** | ||
* The user. | ||
* | ||
* @var \CachetHQ\Cachet\Models\User | ||
*/ | ||
public $user; | ||
|
||
/** | ||
* The validation rules. | ||
* | ||
* @var string[] | ||
*/ | ||
public $rules = [ | ||
'incident' => 'required', | ||
'status' => 'required|int|min:1|max:4', | ||
'message' => 'required|string', | ||
'user' => 'required', | ||
]; | ||
|
||
/** | ||
* Create a new report incident update command instance. | ||
* | ||
* @param \CachetHQ\Cachet\Models\Incident $incident | ||
* @param string $status | ||
* @param string $message | ||
* @param \CachetHQ\Cachet\Models\User $user | ||
* | ||
* @return void | ||
*/ | ||
public function __construct(Incident $incident, $status, $message, User $user) | ||
{ | ||
$this->incident = $incident; | ||
$this->status = $status; | ||
$this->message = $message; | ||
$this->user = $user; | ||
} | ||
} |
81 changes: 81 additions & 0 deletions
81
app/Bus/Commands/IncidentUpdate/UpdateIncidentUpdateCommand.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of Cachet. | ||
* | ||
* (c) Alt Three Services Limited | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace CachetHQ\Cachet\Bus\Commands\IncidentUpdate; | ||
|
||
use CachetHQ\Cachet\Models\IncidentUpdate; | ||
use CachetHQ\Cachet\Models\User; | ||
|
||
/** | ||
* This is the update incident update command. | ||
* | ||
* @author James Brooks <james@alt-three.com> | ||
*/ | ||
final class UpdateIncidentUpdateCommand | ||
{ | ||
/** | ||
* The incident update. | ||
* | ||
* @var \CachetHQ\Cachet\Models\IncidentUpdate | ||
*/ | ||
public $update; | ||
|
||
/** | ||
* The incident status. | ||
* | ||
* @var int | ||
*/ | ||
public $status; | ||
|
||
/** | ||
* The incident message. | ||
* | ||
* @var string | ||
*/ | ||
public $message; | ||
|
||
/** | ||
* The user. | ||
* | ||
* @var \CachetHQ\Cachet\Models\User | ||
*/ | ||
public $user; | ||
|
||
/** | ||
* The validation rules. | ||
* | ||
* @var string[] | ||
*/ | ||
public $rules = [ | ||
'update' => 'required', | ||
'status' => 'int|min:1|max:4', | ||
'message' => 'string', | ||
'user' => 'required', | ||
]; | ||
|
||
/** | ||
* Create a new update incident update command instance. | ||
* | ||
* @param \CachetHQ\Cachet\Models\IncidentUpdate $update | ||
* @param string $status | ||
* @param string $message | ||
* @param \CachetHQ\Cachet\Models\User $user | ||
* | ||
* @return void | ||
*/ | ||
public function __construct(IncidentUpdate $update, $status, $message, User $user) | ||
{ | ||
$this->update = $update; | ||
$this->status = $status; | ||
$this->message = $message; | ||
$this->user = $user; | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
app/Bus/Events/IncidentUpdate/IncidentUpdateEventInterface.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of Cachet. | ||
* | ||
* (c) Alt Three Services Limited | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace CachetHQ\Cachet\Bus\Events\IncidentUpdate; | ||
|
||
use CachetHQ\Cachet\Bus\Events\EventInterface; | ||
|
||
/** | ||
* This is the incident update event interface. | ||
* | ||
* @author James Brooks <james@alt-three.com> | ||
*/ | ||
interface IncidentUpdateEventInterface extends EventInterface | ||
{ | ||
// | ||
} |
41 changes: 41 additions & 0 deletions
41
app/Bus/Events/IncidentUpdate/IncidentUpdateWasRemovedEvent.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of Cachet. | ||
* | ||
* (c) Alt Three Services Limited | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace CachetHQ\Cachet\Bus\Events\IncidentUpdate; | ||
|
||
use CachetHQ\Cachet\Models\IncidentUpdate; | ||
|
||
/** | ||
* This is the incident update was removed event. | ||
* | ||
* @author James Brooks <james@alt-three.com> | ||
*/ | ||
final class IncidentUpdateWasRemovedEvent implements IncidentUpdateEventInterface | ||
{ | ||
/** | ||
* The incident update that has been removed. | ||
* | ||
* @var \CachetHQ\Cachet\Models\IncidentUpdate | ||
*/ | ||
public $update; | ||
|
||
/** | ||
* Create a new incident update was removed event instance. | ||
* | ||
* @param \CachetHQ\Cachet\Models\IncidentUpdate $update | ||
* | ||
* @return void | ||
*/ | ||
public function __construct(IncidentUpdate $update) | ||
{ | ||
$this->update = $update; | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
app/Bus/Events/IncidentUpdate/IncidentUpdateWasReportedEvent.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of Cachet. | ||
* | ||
* (c) Alt Three Services Limited | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace CachetHQ\Cachet\Bus\Events\IncidentUpdate; | ||
|
||
use CachetHQ\Cachet\Models\IncidentUpdate; | ||
|
||
/** | ||
* This is the incident update was reported event. | ||
* | ||
* @author James Brooks <james@alt-three.com> | ||
*/ | ||
final class IncidentUpdateWasReportedEvent implements IncidentUpdateEventInterface | ||
{ | ||
/** | ||
* The incident update that has been reported. | ||
* | ||
* @var \CachetHQ\Cachet\Models\IncidentUpdate | ||
*/ | ||
public $update; | ||
|
||
/** | ||
* Create a new incident update was reported event instance. | ||
* | ||
* @param \CachetHQ\Cachet\Models\IncidentUpdate $update | ||
* | ||
* @return void | ||
*/ | ||
public function __construct(IncidentUpdate $update) | ||
{ | ||
$this->update = $update; | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
app/Bus/Events/IncidentUpdate/IncidentUpdateWasUpdatedEvent.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of Cachet. | ||
* | ||
* (c) Alt Three Services Limited | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace CachetHQ\Cachet\Bus\Events\IncidentUpdate; | ||
|
||
use CachetHQ\Cachet\Models\IncidentUpdate; | ||
|
||
/** | ||
* This is the incident update was updated event. | ||
* | ||
* @author James Brooks <james@alt-three.com> | ||
*/ | ||
final class IncidentUpdateWasUpdatedEvent implements IncidentUpdateEventInterface | ||
{ | ||
/** | ||
* The incident update that has been updated. | ||
* | ||
* @var \CachetHQ\Cachet\Models\IncidentUpdate | ||
*/ | ||
public $update; | ||
|
||
/** | ||
* Create a new incident update was updated event instance. | ||
* | ||
* @param \CachetHQ\Cachet\Models\IncidentUpdate $update | ||
* | ||
* @return void | ||
*/ | ||
public function __construct(IncidentUpdate $update) | ||
{ | ||
$this->update = $update; | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
app/Bus/Handlers/Commands/IncidentUpdate/RemoveIncidentUpdateCommandHandler.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of Cachet. | ||
* | ||
* (c) Alt Three Services Limited | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace CachetHQ\Cachet\Bus\Handlers\Commands\IncidentUpdate; | ||
|
||
use CachetHQ\Cachet\Bus\Commands\IncidentUpdate\RemoveIncidentUpdateCommand; | ||
use CachetHQ\Cachet\Bus\Events\IncidentUpdate\IncidentUpdateWasRemovedEvent; | ||
|
||
/** | ||
* This is the remove incident update command handler. | ||
* | ||
* @author James Brooks <james@alt-three.com> | ||
*/ | ||
class RemoveIncidentUpdateCommandHandler | ||
{ | ||
/** | ||
* Handle the remove incident update command. | ||
* | ||
* @param \CachetHQ\Cachet\Bus\Commands\IncidentUpdate\RemoveIncidentUpdateCommand $command | ||
* | ||
* @return void | ||
*/ | ||
public function handle(RemoveIncidentUpdateCommand $command) | ||
{ | ||
$update = $command->incidentUpdate; | ||
|
||
event(new IncidentUpdateWasRemovedEvent($update)); | ||
|
||
$update->delete(); | ||
} | ||
} |
Oops, something went wrong.