By default, Laravel uses Carbon for dates, but the object returned by the \Illuminate\Support\Facades\Date helper is mutable.

To configure Laravel to use CarbonImmutable instead, call this method in your AppServiceProvider's boot() method:

<?php
use Carbon\CarbonImmutable;
use Illuminate\Support\Facades\Date;

class AppServiceProvider extends ServiceProvider
{
    public function boot()
    {
        Date::use(CarbonImmutable::class);
  }
}

Just make sure to use Laravel's Date facade instead of Carbon directly in your application code.

continue reading on rias.be

⚠️ This post links to an external website. ⚠️