DEV Community

loading...
Cover image for Laravel clear cache without using artisan command

Laravel clear cache without using artisan command

larainfo
Full Stack Developer | Laravel | Livewire | Vue Js Nodejs, tailwind css
Updated on ・1 min read

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...

Discussion (0)