Laravel Carbon Diff. Carbon add diff methods for each unit too such as diffinyears diffinmonths and so on. We will see simple example of diffforhumans of carbon in laravel 6 laravel 7 and laravel 8 application.
This will make the closure action available on all carbon instances. In following example you can see we have a two dates first to variable and second one from variable. Laravel by default provide carbon class.
Call the carbon macro method with the name of your macro as the first argument and a closure as the second argument.
Use 1 25 0 alias for laravel 5 6 1 39 0 for other versions as each version of laravel has its own range of carbon compatibility you have to take 2 42 0 you may have other dependencies with other carbon restrictions. Call the carbon macro method with the name of your macro as the first argument and a closure as the second argument. Carbon class throught you can calculate difference between two dates in days. Carbon lets us easily display time relatively with the diff methods.
