• Hello, Visitor
  • Monday, November 11, 2024
Search Result
Home » Laravel » How to Clear Cache In Laravel 8

How to Clear Cache In Laravel 8

Hello Friends,

In this tutorial, we are going to learn how to clear route cache, laravel application cache, config cache, view cache and reoptimized class in a Laravel 8 application using artisan command-line interface.

Sometimes we need to clear cache when we change something in configuration files or anything change on view files after long time.

The bellow commands will help you to clear cache in laravel 8


Clear Cache:

php artisan clear:cache


Clear Route Cache:

php artisan route:cache


Clear View Cache:

php artisan view:clear


Clear Config Cache:

php artisan config:cache


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

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


Hope it will help you.

Thanks.


Leave a Reply

You must Login to add a comment