Relationship for incidents reported on the component

This commit is contained in:
James Brooks
2014-11-25 09:04:03 +00:00
parent 429e717278
commit 9ce390c780

View File

@@ -1,6 +1,14 @@
<?php
class Component extends Eloquent implements Dingo\Api\Transformer\TransformableInterface {
/**
* Lookup all of the incidents reported on the component.
* @return Illuminate\Database\Eloquent\Relations
*/
public function incidents() {
return $this->hasMany('Incident', 'component_id', 'id');
}
/**
* Looks up the human readable version of the status.
* @return string
@@ -32,8 +40,7 @@
*
* @return mixed
*/
public function getTransformer()
{
public function getTransformer() {
return new ComponentTransformer();
}
}