Laravel 9 Clear Cache, Route, Config and View

Laravel Clear Cache
Laravel Clear Cache

Laravel 9 clear cache types (route, configuration, view, and application) commands. In this Laravel tutorial, you will learn two ways to clear all types of archives (route, configuration, view, and application) in Laravel 9 applications using the command line and Laravel master command.

For example, If your app is in Product Mode or Live Mode; you need to create a repository in Laravel applications to complete it better. But when your apps are in development mode what you want to do is not curable because of the cache. At this time it is necessary to clear all types of archives.

How to clear Cache on Laravel 9?


Using Command-Line or Command Prompt
Using Artisan Commands

Want to learn Laravel subscribe to my Youtube channel for full Laravel tutorial.

Solution 1: – Laravel Cache Clear using Command Line

  • Laravel Clear the Route Store
  • Laravel Clear App Store
  • Laravel Clear Editing Cache
  • Laravel Clear Cache View
  • Laravel Clear the Cache using the Reorganized Class
  • Laravel Clear the Route Store

Route Cache Clear Command

Use the command below and clear your route repository:

php artisan route:cache

Laravel Clear App Store

Use the command below and clear your application cache as session, cookie cache:

php artisan route:clear

Laravel Clear App Config Cache

Use the command below and clear your cache:

php artisan config:cache


Laravel Clear Cache View

Use the command below and clear your cache (blade):

php artisan view:clear


Laravel Clear the Cache using the Reorganized Class

php artisan optimize

Clear All with one Command

php artisan optimize:clear
Watch the full Laravel Inertia JS tutorial 


Solution 2: – Laravel Cache Clear using Artisan Command


If you do not have access to SSH on shared hosting servers, we may also clear the cache by typing the code in the router file. Go to your web.php file and enter the code below to clear your application cache:

1 Clear the route cache:
Route::get('/route-cache', function() {
     Artisan::call('route:cache');
     return 'Routes cache cleared';
 });
Watch the full Laravel Livewire tutorial
2 Clear config cache
Route::get('/config-cache', function() {
    Artisan::call('config:cache');
     return 'Config cache cleared';
 });
3 Clear Application cache
 Route::get('/clear-cache', function() {
     Artisan::call('cache:clear');
     return 'Application cache cleared';
 });
4 Clear view cache
Route::get('/view-clear', function() {
     Artisan::call('view:clear');
     return 'View cache cleared';
 });
5 Clear all at once
Route::get('/view-clear', function() {
     Artisan::call('optimize:clear');
     return 'Optimize Clear all cache';
 });

Laravel 9 Clear Cache blog post.

Recommended Laravel tutorials.

Laravel Inertia JS tutorial CRUD with file upload
Multistep Form with Laravel & Inertia JS Video Tutorial
Laravel Livewire CRUD Tutorial with File Upload
Laravel Filament Admin Panel
Laravel Livewire Datatable Package

Leave a Reply

Your email address will not be published.