Format meta for incidents as key/value pairs

This commit is contained in:
James Brooks
2017-06-13 19:34:42 +01:00
parent 27e390ec17
commit 63e38a4b2c

View File

@@ -279,6 +279,16 @@ class IncidentPresenter extends BasePresenter implements Arrayable
return 0;
}
/**
* Return the meta in a key value pair.
*
* @return array
*/
public function meta()
{
return $this->wrappedObject->meta->pluck('value', 'key')->all();
}
/**
* Convert the presenter instance to an array.
*
@@ -294,6 +304,7 @@ class IncidentPresenter extends BasePresenter implements Arrayable
'latest_icon' => $this->latest_icon(),
'permalink' => $this->permalink(),
'duration' => $this->duration(),
'meta' => $this->meta(),
'occurred_at' => $this->occurred_at(),
'created_at' => $this->created_at(),
'updated_at' => $this->updated_at(),