Laravel is an open-source PHP framework, which is robust and easy to understand. It follows a model-view-controller design pattern. Laravel reuses the existing components of different frameworks which helps in creating a web application. The web application thus designed is more structured and pragmatic.
A cache is a reserved storage location that collects temporary data to help websites, browsers, and apps load faster. Whether it's a computer, laptop or phone, web browser or app, you'll find some variety of a cache.
Sometimes users face an issue that changes on Laravel app do not shown on web interfaces. This is where cache involved!
This tutorial will help you to clear the cache in your Laravel app. Below you see to solutions: Clear cache in Laravel(Terminal) and Clear cache in laravel (Browser)
Run the following command to clear the application cache of the Laravel application.
php artisan cache:clear
Run the following command to clear the route cache of the Laravel application.
php artisan route:clear
You can use config:clear to clear the config cache of the Laravel application.
php artisan config:clear
Also, you may need to clear compiled view files of your Laravel application. To clear compiled view files run the following command from the terminal.
php artisan view:clear
Most of the shared hosting providers don’t provide SSH access to the systems. In that case, you can clear the Laravel cache by calling the URL in the browser. You can simply place the below code in your routes/web.php file of the Laravel application. Then access this URL in the browser to clear the cache of the Laravel application.
Route::get('/clear-cache', function() {
Artisan::call('cache:clear');
return "Cache is cleared";
});