Laravel 9 Clear Cache of Route, View, Config Command Tutorial

May 02, 2022 . Admin

Today,

In this blog, I will give you an example of laravel 9 clear cache. you will learn laravel 9 clear cache config. This article will give you a simple example of laravel 9 cache clear view. We will look at example of laravel 9 cache clear config. You just need to some step to done laravel 9 cache clear command.

I was fetching one issue suddenly my view cache with an error during development. I did try a lot to refresh and something other but I can't see any more change in my view, at last, I did resolve my problem using laravel command so, let's see I added several commands for clear cache from view, route, confirm, etc.

Step 1: Download Laravel

Let us begin the tutorial by installing a new laravel application. if you have already created the project, then skip following step.

composer create-project laravel/laravel example-app
Step 2: Clear Cache:
php artisan cache:clear
Step 3: Clear Route Cache:
php artisan route:cache
Step 4: Clear View Cache:
php artisan view:clear
Step 5: Clear Config Cache:
php artisan config:cache

You can also clear cache without command using the route. so you can create a route as like bellow:

Step 6: Create Route
<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/clear-cache-all', function() {
    Artisan::call('cache:clear');
  
    dd("Cache Clear All");
});

It will help you...

#Laravel 9