29 lines
682 B
PHP
29 lines
682 B
PHP
<?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');
|
|
}
|
|
|
|
/**
|
|
* Looks up the human readable version of the status.
|
|
* @return string
|
|
*/
|
|
public function getHumanStatusAttribute() {
|
|
return Lang::get('component.status.' . $this->status);
|
|
}
|
|
|
|
/**
|
|
* Get the transformer instance.
|
|
*
|
|
* @return ComponentTransformer
|
|
*/
|
|
public function getTransformer() {
|
|
return new ComponentTransformer();
|
|
}
|
|
}
|