In this tutorial you will learn about the Laravel Clear Cache on Shared Hosting without Artisan command and its application with practical example.
Laravel Clear Cache on Shared Hosting
In this laravel clear cache shared hosting tutorial, I’ll show you how to clear cache on shared hosting using laravel route. In shared host we dont have access to command line (CLI), in this tutorial I’ll show you to clear cache without artisan command.To clear laravel cache we have to define routes in our application’s routes/web.php file that invoke the various laravel clear cache commands. This way we can clear Laravel cache by accessing specific routes in the browser.
Laravel Clear Route Cache On Shared Hosting
Lets define “route-cache” route in routes/web.php file to clear route cache without using artisan command.
1 2 3 4 |
Route::get('/route-cache', function() { $exitCode = Artisan::call('route:cache'); return 'Routes cache cleared'; }); |
Laravel Clear Config Cache On Shared Hosting
Lets define “config-cache” route in routes/web.php file to clear config cache without using artisan command.
1 2 3 4 |
Route::get('/config-cache', function() { $exitCode = Artisan::call('config:cache'); return 'Config cache cleared'; }); |
Laravel Clear Application Cache On Shared Hosting
Lets define “clear-cache” route in routes/web.php file to clear application cache without using artisan command.
1 2 3 4 |
Route::get('/clear-cache', function() { $exitCode = Artisan::call('cache:clear'); return 'Application cache cleared'; }); |
Laravel Clear View Cache On Shared Hosting
Lets define “view-clear” route in routes/web.php file to clear view cache without using artisan command.
1 2 3 4 |
Route::get('/view-clear', function() { $exitCode = Artisan::call('view:clear'); return 'View cache cleared'; }); |