In your Laravel Application, clear cache easily with these quick and helpful artisan commands.
In this quick tutorial, I will mention few artisan commands you can use to clear various types of cache like config cache, view cache, route cache, and application cache from your laravel application.
This can be useful and sometimes essential while working on your Laravel application.
Using Terminal, go to the Laravel application's folder. Then execute the following commands as needed to clear cache from laravel.
Clear Application Cache
To clear laravel application cache, run the following artisan command:
Clear Route Cache
To clear route cache of your Laravel application run the following artisan command:
Clear Configuration Cache
To clear the config cache of your laravel application, run the following artisan command:
Clear Compiled Views Cache
To clear the view cache of your laravel application which are basically compiled view files, run the following artisan command:
Sometimes, it's hard to get console access to your laravel application. Thus, it would be easier if we could clear the cache of laravel application through the browser, right? No worries, we can do that too!
Also, this method is useful for users who are using shared hosting for their laravel application! Since it's a bit complex to run artisan commands via the terminal in shared hosting, we can and will use the browser method.
Here, we are still using the same artisan commands as mentioned above. It's just that, those commands can be run programmatically in Laravel. Thus, we will create special routes to clear cache in Laravel.