Sometimes we come into situations like it seems to be everything correct but the application always shows an error. Moreover, after we changed the code, it always renders the same old code again and again. Since I have faced this many times, it is most probably due to cached data. In such case, we need to clear our cache from the application.
Let’s start clearing our cache one by one:
Clear Application Cache
This command is used to clear Application cache files.
php artisan cache:clear
Clear View Cache
This command is used to clear Route cache.
php artisan view:clear
Clear Route Cache
This command is used to clear Route cache.
php artisan route:cache
Clear Config Cache
This command is used to clear Config cache.
php artisan config:cache
Clear Compiled Cache
This command is used to clear the compiled classes and services application cache.
php artisan clear-compiled
Artisan command outside CLI
You can also delete your cache data outside of CLI. For this, you need to use Artisan
Facade. For this, we will define routes for each command and execute over HTTP request.
Another thing to remember is that Artisan command can also be executed through
Queue
which executes in application background.'foo']); // });That is all about clearing cached data in laravel 5. Hope you like the article. Please feel free to send feedback through the comment box below.