From d2975cd1eb7db4109ad3a996fe1419e686656172 Mon Sep 17 00:00:00 2001 From: Knight Tan Date: Thu, 26 Oct 2017 09:16:20 +0800 Subject: [PATCH] added component and status to CreateIncidentUpdateCommand --- .../CreateIncidentUpdateCommand.php | 18 +++++++++++++++++- .../Dashboard/IncidentController.php | 2 ++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/app/Bus/Commands/IncidentUpdate/CreateIncidentUpdateCommand.php b/app/Bus/Commands/IncidentUpdate/CreateIncidentUpdateCommand.php index 048465b8..fed281c3 100644 --- a/app/Bus/Commands/IncidentUpdate/CreateIncidentUpdateCommand.php +++ b/app/Bus/Commands/IncidentUpdate/CreateIncidentUpdateCommand.php @@ -41,7 +41,19 @@ final class CreateIncidentUpdateCommand * @var string */ public $message; + /** + * The incident component. + * + * @var int + */ + public $component_id; + /** + * The component status. + * + * @var int + */ + public $component_status; /** * The user. * @@ -58,6 +70,8 @@ final class CreateIncidentUpdateCommand 'incident' => 'required', 'status' => 'required|int|min:1|max:4', 'message' => 'required|string', + 'component_id' => 'nullable|required_with:component_status|int', + 'component_status' => 'nullable|required_with:component_id|int|min:0|max:4', 'user' => 'required', ]; @@ -71,11 +85,13 @@ final class CreateIncidentUpdateCommand * * @return void */ - public function __construct(Incident $incident, $status, $message, User $user) + public function __construct(Incident $incident, $status, $message, $component_id, $component_status, User $user) { $this->incident = $incident; $this->status = $status; $this->message = $message; + $this->component_id = $component_id; + $this->component_status = $component_status; $this->user = $user; } } diff --git a/app/Http/Controllers/Dashboard/IncidentController.php b/app/Http/Controllers/Dashboard/IncidentController.php index 09b8a7b2..865a8145 100644 --- a/app/Http/Controllers/Dashboard/IncidentController.php +++ b/app/Http/Controllers/Dashboard/IncidentController.php @@ -339,6 +339,8 @@ class IncidentController extends Controller $incident, Binput::get('status'), Binput::get('message'), + Binput::get('component_id'), + Binput::get('component_status'), $this->auth->user() )); } catch (ValidationException $e) {