Sometimes you may face an issue that the changes to the Laravel Project may not update on the web. This occures when the application is served by the cache. In this tutorial, You’ll learn to Clear Application, Route, Config, Browser Cache in Laravel Project.
Go to your Laravel Project and open the Terminal. Here you can type the commands to clear cache as show below :
- Clear Route Cache
Type the following command to clear route cache of the Laravel application.
php artisan route:cache
- Optimize Laravel Cache
php artisan optimize
- Clear Application Cache
Type the following command to clear application cache of the Laravel application.
php artisan cache:clear
- Clear Configuration Cache
Type the following command to clear configuration cache of the Laravel application.
php artisan config:cache
- Clear View Cache
Type the following command to clear view cache of the Laravel application.
php artisan view:clear
- Clear Browser Cache
You can clear the cache by defining the command inside the router.Then access this URL in the browser to clear the cache of Laravel project.
Route::get('/clear-cache', function() {
Artisan::call('cache:clear');
return "Cache is cleared";
});
Hope this tutorial helped you! Feel free to drop your opinion at the comment section.