mirror of
https://github.com/CachetHQ/Cachet.git
synced 2025-02-22 10:44:09 +01:00
66 lines
1.5 KiB
PHP
66 lines
1.5 KiB
PHP
<?php
|
|
|
|
/*
|
|
* This file is part of Cachet.
|
|
*
|
|
* (c) Alt Three Services Limited
|
|
*
|
|
* For the full copyright and license information, please view the LICENSE
|
|
* file that was distributed with this source code.
|
|
*/
|
|
|
|
namespace CachetHQ\Cachet\Presenters\Traits;
|
|
|
|
use CachetHQ\Cachet\Dates\DateFactory;
|
|
use Illuminate\Support\Facades\Config;
|
|
|
|
/**
|
|
* This is the timestamps trait.
|
|
*
|
|
* @author Joseph Cohen <joe@alt-three.com>
|
|
* @author Graham Campbell <graham@alt-three.com>
|
|
* @author James Brooks <james@alt-three.com>
|
|
*/
|
|
trait TimestampsTrait
|
|
{
|
|
/**
|
|
* Present formatted date time.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function created_at()
|
|
{
|
|
return app(DateFactory::class)->make($this->wrappedObject->created_at)->toDateTimeString();
|
|
}
|
|
|
|
/**
|
|
* Present formatted date time.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function updated_at()
|
|
{
|
|
return app(DateFactory::class)->make($this->wrappedObject->updated_at)->toDateTimeString();
|
|
}
|
|
|
|
/**
|
|
* Present formatted date time.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function deleted_at()
|
|
{
|
|
return app(DateFactory::class)->make($this->wrappedObject->deleted_at)->toDateTimeString();
|
|
}
|
|
|
|
/**
|
|
* Get the incident date format setting, or fallback to a sane default.
|
|
*
|
|
* @return string
|
|
*/
|
|
protected function incidentDateFormat()
|
|
{
|
|
return Config::get('setting.incident_date_format', 'l jS F Y H:i:s');
|
|
}
|
|
}
|