2015-05-20 12:57:22 -05:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This file is part of Cachet.
|
|
|
|
*
|
2015-07-06 17:37:01 +01:00
|
|
|
* (c) Alt Three Services Limited
|
2015-05-20 12:57:22 -05:00
|
|
|
*
|
|
|
|
* For the full copyright and license information, please view the LICENSE
|
|
|
|
* file that was distributed with this source code.
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace CachetHQ\Cachet\Presenters\Traits;
|
|
|
|
|
2016-02-02 20:35:31 +00:00
|
|
|
use CachetHQ\Cachet\Dates\DateFactory;
|
2016-10-29 17:25:52 +01:00
|
|
|
use Illuminate\Support\Facades\Config;
|
2015-05-20 12:57:22 -05:00
|
|
|
|
2016-10-29 17:25:52 +01:00
|
|
|
/**
|
|
|
|
* 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>
|
|
|
|
*/
|
2015-05-20 12:57:22 -05:00
|
|
|
trait TimestampsTrait
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Present formatted date time.
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function created_at()
|
|
|
|
{
|
2016-02-02 20:35:31 +00:00
|
|
|
return app(DateFactory::class)->make($this->wrappedObject->created_at)->toDateTimeString();
|
2015-05-20 12:57:22 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Present formatted date time.
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function updated_at()
|
|
|
|
{
|
2016-02-02 20:35:31 +00:00
|
|
|
return app(DateFactory::class)->make($this->wrappedObject->updated_at)->toDateTimeString();
|
2015-05-20 12:57:22 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Present formatted date time.
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function deleted_at()
|
|
|
|
{
|
2016-02-02 20:35:31 +00:00
|
|
|
return app(DateFactory::class)->make($this->wrappedObject->deleted_at)->toDateTimeString();
|
2015-05-20 12:57:22 -05:00
|
|
|
}
|
2016-10-29 17:25:52 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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');
|
|
|
|
}
|
2015-05-20 12:57:22 -05:00
|
|
|
}
|