Search code examples
phplaravellamplaravel-bladephp-carbon

Carbon throwing errors in lamp server


Laravel is throwing Class Carbon not found, I created the application in local environment and it's working, but when I deployed it to digitalocean server, it doesn't seem to work. here is the code:

{{ \Carbon\Carbon::parse($entity['start_date'])->format('d') }}

And we also tried:

{{ Carbon::parse($entity['start_date'])->format('d') }}

And here is the error it throws:

Class 'Carbon' not found (View: /var/www/html/resources/views/common/components/single_slider_event.blade.php) (View:

And the alies is set up correctly:

'aliases' => [
      'Carbon' => Carbon\Carbon::class,
],

Any help is appreciated in advance.


Solution

  • I solved the issue by running the following commands, it seems like even if you run composer install it might not work in the public environment.

    composer update
    php artisan config:clear
    php artisan cache:clear 
    composer dumpautoload
    php artisan cache:clear
    

    good luck!