diff --git a/app/database/seeds/IncidentTableSeeder.php b/app/database/seeds/IncidentTableSeeder.php index 1d5d6719..8545ad42 100644 --- a/app/database/seeds/IncidentTableSeeder.php +++ b/app/database/seeds/IncidentTableSeeder.php @@ -14,22 +14,26 @@ class IncidentTableSeeder extends Seeder { $defaultIncidents = [ [ "name" => "Test Incident", - "message" => "Something went wrong, oh noes." + "message" => "Something went wrong, oh noes.", + "component" => 1, ], [ "name" => "Update", "message" => "We've found the problem, so we're looking at it.", - "status" => 2 + "status" => 2, + "component" => 1, ], [ "name" => "Monitoring the fix", "message" => "We're checking that our fix will first work.", - "status" => 3 + "status" => 3, + "component" => 1, ], [ "name" => "Awesome", "message" => "We totally nailed the fix.", - "status" => 4 + "status" => 4, + "component" => 2, ] ]; diff --git a/app/models/Incident.php b/app/models/Incident.php index 9e5a137f..6e1a7420 100644 --- a/app/models/Incident.php +++ b/app/models/Incident.php @@ -1,6 +1,18 @@ belongsTo('Component', 'component', 'id'); + } + + /** + * Returns a human readable version of the status. + * @return string + */ public function getHumanStatusAttribute() { switch ($this->status) { case 1: return 'Investigating'; @@ -10,29 +22,29 @@ } } + /** + * Looks up the class name for the status. + * @return string + */ public function getColorAttribute() { switch ($this->status) { - case 1: - return 'warning'; - case 2: - return 'alert'; - case 3: - return 'info'; - case 4: - return 'success'; + case 1: return 'warning'; + case 2: return 'alert'; + case 3: return 'info'; + case 4: return 'success'; } } + /** + * Finds the icon to use for each status. + * @return string + */ public function getIconAttribute() { switch ($this->status) { - case 1: - return 'glyphicon-flag'; - case 2: - return 'glyphicon-warning-sign'; - case 3: - return 'glyphicon-eye-open'; - case 4: - return 'glyphicon-ok'; + case 1: return 'glyphicon-flag'; + case 2: return 'glyphicon-warning-sign'; + case 3: return 'glyphicon-eye-open'; + case 4: return 'glyphicon-ok'; } } }