In this tutorial you will learn about the Laravel Clear route cache and its application with practical example.
Laravel Clear Route Cache
In this Laravel Clear Route Cache tutorial, I’ll show you how to clear route cache in laravel application. You’ll learn to clear route cache using artisan command as well as learn to clear laravel route cache on shared host from browser.
Clear Route Cache Using Artisan Command
To clear route cache in laravel use the php artisan route:clear artisan command as given below :
1 |
php artisan route:clear |
Laravel Clear Route 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 route cache we have define a route in our application’s routes/web.php file that invoke the laravel clear route cache command. This way we can clear route cache by accessing specific routes in the browser.
1 2 3 4 |
Route::get('/route-cache', function() { $exitCode = Artisan::call('route:cache'); return 'Routes cache cleared'; }); |