From a70d9ce530b12df18ccd51fa3aa16ae6feec472b Mon Sep 17 00:00:00 2001 From: James Brooks Date: Sat, 7 Nov 2015 11:20:45 +0000 Subject: [PATCH] Added status value validation to commands --- app/Commands/Component/AddComponentCommand.php | 2 +- app/Commands/Component/UpdateComponentCommand.php | 2 +- app/Commands/Incident/ReportIncidentCommand.php | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Commands/Component/AddComponentCommand.php b/app/Commands/Component/AddComponentCommand.php index 7a5bffd7..da71d0b5 100644 --- a/app/Commands/Component/AddComponentCommand.php +++ b/app/Commands/Component/AddComponentCommand.php @@ -70,7 +70,7 @@ final class AddComponentCommand public $rules = [ 'name' => 'required|string', 'description' => 'string', - 'status' => 'required|int', + 'status' => 'int|min:1|max:4', 'link' => 'url', 'order' => 'int', 'group_id' => 'int', diff --git a/app/Commands/Component/UpdateComponentCommand.php b/app/Commands/Component/UpdateComponentCommand.php index 6ab4624d..da3c22cb 100644 --- a/app/Commands/Component/UpdateComponentCommand.php +++ b/app/Commands/Component/UpdateComponentCommand.php @@ -79,7 +79,7 @@ final class UpdateComponentCommand public $rules = [ 'name' => 'string', 'description' => 'string', - 'status' => 'int', + 'status' => 'int|min:1|max:4', 'link' => 'url', 'order' => 'int', 'group_id' => 'int', diff --git a/app/Commands/Incident/ReportIncidentCommand.php b/app/Commands/Incident/ReportIncidentCommand.php index 6da77d25..fd736798 100644 --- a/app/Commands/Incident/ReportIncidentCommand.php +++ b/app/Commands/Incident/ReportIncidentCommand.php @@ -76,11 +76,11 @@ final class ReportIncidentCommand */ public $rules = [ 'name' => 'required|string', - 'status' => 'required|int', + 'status' => 'required|int|min:0|max:4', 'message' => 'string', 'visible' => 'bool', 'component_id' => 'int', - 'component_status' => 'int', + 'component_status' => 'int|min:1|max:4', 'notify' => 'bool', 'incident_date' => 'string', ];