Clearing Route, View, Config Cache in Laravel 5.8

Sometimes you may face an issue that the changes to the Laravel Project may not update on the web. This occures when the application is served by the cache.

In this tutorial, You'll learn to Clear Application, Route, Config, Browser Cache in Laravel Project.

Go to your Laravel Project and open the Terminal. Here you can type the commands to clear cache as show below :

  1. Clear Route Cache

    Type the following command to clear route cache of the Laravel application.

    php artisan route:cache
  2. Optimize Laravel Cache

    Note : The Artisan optimize command is deprecated as of 5.5. With recent improvements to PHP itself including the OPcache, the optimize command no longer provides any benefit.

    php artisan optimize
  3. Clear Application Cache

    Type the following command to clear application cache of the Laravel application.

    php artisan cache:clear
  4. Clear Configuration Cache

    Type the following command to clear configuration cache of the Laravel application.

    php artisan config:cache
  5. Clear View Cache

    Type the following command to clear view cache of the Laravel application.

    php artisan view:clear
  6. Clear Browser Cache

    You can clear the cache by defining the command inside the router.Then access this URL in the browser to clear the cache of Laravel project.

    Route::get('/clear-cache', function() {
        Artisan::call('cache:clear');
        return "Cache is cleared";
    });

Hope this tutorial helped you! Feel free to drop your opinion at the comment section.