Add tag names array to components api. Closes #1697

This commit is contained in:
James Brooks
2016-04-16 12:05:46 +01:00
parent 6e7df6e1f7
commit ed77a6753c

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(),
]);
}
}