Support the ongoing development of Laravel.io →
posted 10 years ago
Packages
Last updated 2 years ago.
0

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

Last updated 2 years ago.
0

Put

use Carbon/Carbon 

at the top of the file might work.

Last updated 2 years 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 2 years ago.
0

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

Last updated 2 years 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 8 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

damonsharp damonsharp Joined 14 Feb 2014

Moderators

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

Your logo here?

Laravel.io

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

© 2024 Laravel.io - All rights reserved.