Move HumanStatus to Presenter

This commit is contained in:
phecho
2015-12-23 19:44:06 +08:00
parent d5a71976d2
commit 8a47dd873f
6 changed files with 15 additions and 15 deletions

View File

@@ -157,16 +157,6 @@ class Component extends Model implements HasPresenter
return $query->where('enabled', false);
}
/**
* Looks up the human readable version of the status.
*
* @return string
*/
public function getHumanStatusAttribute()
{
return trans('cachet.components.status.'.$this->status);
}
/**
* Returns all of the tags on this component.
*

View File

@@ -32,6 +32,16 @@ class ComponentPresenter extends AbstractPresenter
}
}
/**
* Looks up the human readable version of the status.
*
* @return string
*/
public function human_status()
{
return trans('cachet.components.status.'.$this->wrappedObject->status);
}
/**
* Convert the presenter instance to an array.
*
@@ -42,7 +52,7 @@ class ComponentPresenter extends AbstractPresenter
return array_merge($this->wrappedObject->toArray(), [
'created_at' => $this->created_at(),
'updated_at' => $this->updated_at(),
'status_name' => $this->wrappedObject->humanStatus,
'status_name' => $this->human_status(),
]);
}
}