Added date factory

This commit is contained in:
Graham Campbell
2015-11-07 13:15:28 +00:00
parent 1a23d84488
commit 592b62b399
2 changed files with 94 additions and 1 deletions

View File

@@ -11,6 +11,7 @@
namespace CachetHQ\Cachet\Providers;
use CachetHQ\Cachet\Dates\DateFactory;
use Illuminate\Bus\Dispatcher;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Str;
@@ -40,6 +41,21 @@ class AppServiceProvider extends ServiceProvider
*/
public function register()
{
//
$this->registerDateFactory();
}
/**
* Register the date factory.
*
* @return void
*/
protected function registerDateFactory()
{
$this->app->singleton(DateFactory::class, function ($app) {
$appTimezone = $app->config->get('app.timezone');
$cacheTimezone = $app->config->get('cachet.timezone');
return new DateFactory($appTimezone, $cacheTimezone);
});
}
}