DEV Community


Laravel Clear Cache Using Artisan

robertlook profile image Robert Look ・1 min read

In This tutorial Simply clear cache from the command line (CLI). we will discuss how to clear cache from blade (views), routes, config, etc using the (CLI) and artisan command.

we need to make cache in laravel projects for better completion. But if our application is development mode then what we want to get cured due to the cache. Then this time we need to clear the cache.

//Clear route cache:
 Route::get('/route-cache', function() {
     $exitCode = Artisan::call('route:cache');
     return 'Routes cache cleared';

 //Clear config cache:
 Route::get('/config-cache', function() {
     $exitCode = Artisan::call('config:cache');
     return 'Config cache cleared';

// Clear application cache:
 Route::get('/clear-cache', function() {
     $exitCode = Artisan::call('cache:clear');
     return 'Application cache cleared';

 // Clear view cache:
 Route::get('/view-clear', function() {
     $exitCode = Artisan::call('view:clear');
     return 'View cache cleared';
Enter fullscreen mode Exit fullscreen mode

laravel clear cache


Editor guide