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 LaravelLet 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-appStep 2: Clear Cache:
php artisan cache:clearStep 3: Clear Route Cache:
php artisan route:cacheStep 4: Clear View Cache:
php artisan view:clearStep 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...