Support the ongoing development of Laravel.io →
Packages
Last updated 3 months ago.
0

Aha, would probably help if I put use Carbon\Carbon at the top of my artisan class. Fixed.

Last updated 3 months ago.
0

Put

use Carbon/Carbon 

at the top of the file might work.

Last updated 3 months ago.
0

And, as you probably know, you can just do \Carbon\Carbon::method() in your class without aliasing the namespace at the top.

Last updated 3 months ago.
0

Or add to aliases: 'Carbon' => 'Carbon\Carbon', so you can use it everywhere

Last updated 3 months ago.
0

I added carbon Facade as "use Carbon/Carbon" and also pass it with aliases but doesn't work yet.

return view('web.home',array('titles'=>$titles,'declarations'=>$declarations,'Carbon' => 'Carbon\Carbon'));

in view i used carbon as below:

Carbon::now()->subSeconds($declaration->created_at)->diffForHumans()

Last updated 6 years ago.
0

Sign in to participate in this thread!

Full Stack Europe

Your banner here too?

damonsharp damonsharp damonsharp Joined 14 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2022 Laravel.io - All rights reserved.