DEV Community

Cover image for Laravel clear cache without using artisan command
saim
saim

Posted on • Updated on

Laravel clear cache without using artisan command

In this tutorial, we are going to learn how to clear route cache, laravel application cache, config cache in a Laravel 8 application using with out artisan command-line interface.

routes/web.php

// clear route cache
Route::get('/clear-route-cache', function () {
    Artisan::call('route:cache');
    return 'Routes cache has clear successfully !';
});

//clear config cache
Route::get('/clear-config-cache', function () {
    Artisan::call('config:cache');
    return 'Config cache has clear successfully !';
});

// clear application cache
Route::get('/clear-app-cache', function () {
    Artisan::call('cache:clear');
    return 'Application cache has clear successfully!';
});

// clear view cache
Route::get('/clear-view-cache', function () {
    Artisan::call('view:clear');
    return 'View cache has clear successfully!';
});
Enter fullscreen mode Exit fullscreen mode

Read more...

Top comments (0)