Reputation: 970
I am using Laravel 5.5 and it has Carbon version 1.27 which has no function like
roundHour()
roundMinute()
which are added in Carbon version 2.
I was trying to update the Carbon version through composer but no success
How can I use Carbon's New version in my Laravel 5.5
Upvotes: 5
Views: 12107
Reputation: 374
Check the latest version of carbon 2 and the latest version of adapter in https://carbon.nesbot.com/#gettingstarted, the instruction to upgrade carbon 1 to 2 is also there.
Upvotes: 2
Reputation: 11656
Carbon update is due in Laravel 5.8 till then the work-around is using laravel-carbon-2 adapter for Laravel.
Basically, add the following dependencies to your composer.json:
{
...
"require": {
...
"kylekatarnls/laravel-carbon-2": "^1.0.0",
"nesbot/carbon": "2.0.0-beta.2 as 1.25.0"
}
...
}
Then run:
composer update
Upvotes: 14