In this tutorial you will learn about the Laravel Clear View Cache and its application with practical example.
Laravel Clear View Cache
In this Laravel Clear View Cache tutorial, I’ll show you how to clear view cache in laravel application. You’ll learn to clear view cache using artisan command as well as learn to clear laravel view cache on shared host from browser.
Clear View Cache Using Artisan Command
To clear compiled view files cache in laravel use the php artisan view:clear artisan command as given below :
1 |
php artisan view:clear |
Clear View Cache On Shared Host
Most of the times in shared hosting servers we don’t have SSH access to the server. In that case, to clear laravel view cache we have define a route in our application’s routes/web.php file that invoke the laravel clear view cache command. This way we can clear view cache by accessing specific routes in the browser.
1 2 3 4 |
Route::get('/view-clear', function() { $exitCode = Artisan::call('view:clear'); return 'View cache cleared'; }); |