php artisan cache:clear
php artisan route:cache
//CLEAR-CACHE
Route::get('/xclean', function() {
$exitCode1 = Artisan::call('cache:clear');
$exitCode2 = Artisan::call('view:clear');
$exitCode3 = Artisan::call('route:clear');
$exitCode4 = Artisan::call('config:cache');
dd('CACHE-CLEARED, VIEW-CLEARED, ROUTE-CLEARED & CONFIG-CACHED WAS SUCCESSFUL!');
});
/*
|=========================================================
| How to clear cache in laravel using route file
|=========================================================
*/
// LINK STORAGE
Route::get('/artisan/link-storage', function () {
Artisan::call('storage:link');
return "Done - storage linked";
});
// CLEAR CACHE
Route::get('/artisan/clear-cache', function() {
Artisan::call('cache:clear');
return "Done - cache are cleared";
});
// CLEAR ROUTES
Route::get('/artisan/route-cache', function() {
Artisan::call('route:cache');
return "Done - routes cache are cleared";
});
// CLEAR VIEWS
Route::get('/artisan/views-clear', function() {
Artisan::call('view:clear');
return "Done - views are cleared from cache";
});