VHFFS – Virtual Hosting For Free Software:
VHFFS is a set of tools to manage a web hosting platform initiated by pooled…
In this article, we will explain how to clear the cache in Laravel Applications.
Talking about Laravel as it is an open-source PHP framework that is used to build web applications, and it works on the MVC model-view-controller framework.
While developing Laravel applications, sometimes the code may not reflect. This issue happens due to caching.
You can use two different ways to clear the caches in Laravel, the first one is through the artisan command and the other one is from the browsers.
Here we will understand the steps where you can use to clear different types of caches like view caches, route caches, config caches, and other application caches from your Laravel application.
Follow the steps to Clear Cache in Laravel Using Artisan Commands:
First of all, you need to open your terminal and find your Laravel application’s folder and execute the command:
php artisan view:clear
php artisan route:clear
php artisan cache:clear
php artisan config:clear
Clear the cache in Laravel through a web browser
Run the following commands, to clear the cache through the browser, as it is difficult to get console access to your Laravel application. The following method is easy and simple.
First of all, you have to create specific routes in Laravel, as shown below:
// Clear application cache:
Route::get('/clear-cache', function() {
Artisan::call('cache:clear');
return 'Application cache has been cleared;
});
//Clear route cache:
Route::get('/route-cache', function() {
Artisan::call('route:cache');
return 'Routes cache has been cleared;
});
//Clear config cache:
Route::get('/config-cache', function() {
Artisan::call('config:cache');
return 'Config cache has been cleared;
});
// Clear view cache:
Route::get('/view-clear', function() {
rtisan::call('view:clear');
return 'View cache has been cleared;
});
In this way, you can clear the cache in Laravel using the Artisan command. Also, check our web hosting plans.
Explore more hosting insights, tips and industry updates.
VHFFS is a set of tools to manage a web hosting platform initiated by pooled…
VPS is well known as a virtual private server. VPS has a server-splitting process. Each…
ClamTK is a graphical front-end for ClamAV, an open-source antivirus engine designed to detect and…