-1

/clear .

an error occurs after adding this piece of code

Artisan::call('route:cache');

in this function

 //cache clear pack
    Route::get('/clear', function() {
    Artisan::call('cache:clear');
    Artisan::call('view:clear');
    Artisan::call('config:cache');
    Artisan::call('config:clear');
    Artisan::call('route:cache');
    Artisan::call('route:clear');
    return "All Cache cleared!!";
});
brombeer
  • 8,716
  • 5
  • 21
  • 27

1 Answers1

1

You can not cache, closures based routes therefore you will need to change any closures(If there are any closures on your route file) to call methods on controllers.

Details can be found here https://paulund.co.uk/laravel-routing-tips

try to have them in a Command class: php artisan make:command myCache

Abilogos
  • 4,777
  • 2
  • 19
  • 39
Yoseph
  • 11
  • 1