Skip to content

Instantly share code, notes, and snippets.

@jakewtaylor
Created March 6, 2019 09:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jakewtaylor/23b61f2026bcde75abed618f7adcf169 to your computer and use it in GitHub Desktop.
Save jakewtaylor/23b61f2026bcde75abed618f7adcf169 to your computer and use it in GitHub Desktop.
How to use CarbonImmutable Laravel 5.8
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
// The Date facade
use Illuminate\Support\Facades\Date;
// And the CarbonImmutable class
use Carbon\CarbonImmutable;
class AppServiceProvider extends ServiceProvider
{
public function register()
{
Date::use(CarbonImmutable::class);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment