Merge pull request #1699 from CachetHQ/tags-on-components-api

Add tag names array to components API
This commit is contained in:
James Brooks
2016-04-21 12:51:48 +01:00

View File

@@ -46,6 +46,16 @@ class ComponentPresenter extends BasePresenter implements Arrayable
return trans('cachet.components.status.'.$this->wrappedObject->status);
}
/**
* Find all tag names for the component names.
*
* @return array
*/
public function tags()
{
return $this->wrappedObject->tags->lists('name', 'slug');
}
/**
* Present formatted date time.
*
@@ -67,6 +77,7 @@ class ComponentPresenter extends BasePresenter implements Arrayable
'created_at' => $this->created_at(),
'updated_at' => $this->updated_at(),
'status_name' => $this->human_status(),
'tags' => $this->tags(),
]);
}
}