Show last updated for components. Closes #1627

This commit is contained in:
James Brooks
2016-03-20 16:23:21 +00:00
parent a64b5c1046
commit dcec1e2e95
3 changed files with 15 additions and 2 deletions
+12
View File
@@ -11,8 +11,10 @@
namespace CachetHQ\Cachet\Presenters;
use CachetHQ\Cachet\Dates\DateFactory;
use CachetHQ\Cachet\Presenters\Traits\TimestampsTrait;
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Support\Facades\Config;
use McCool\LaravelAutoPresenter\BasePresenter;
class ComponentPresenter extends BasePresenter implements Arrayable
@@ -44,6 +46,16 @@ class ComponentPresenter extends BasePresenter implements Arrayable
return trans('cachet.components.status.'.$this->wrappedObject->status);
}
/**
* Present formatted date time.
*
* @return string
*/
public function updated_at_formatted()
{
return ucfirst(app(DateFactory::class)->make($this->wrappedObject->updated_at)->format(Config::get('setting.incident_date_format', 'l jS F Y H:i:s')));
}
/**
* Convert the presenter instance to an array.
*