Skip to content

Instantly share code, notes, and snippets.

@donpandix
Last active February 26, 2024 02:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save donpandix/94bcc707fa226770be399563e2144ec1 to your computer and use it in GitHub Desktop.
Save donpandix/94bcc707fa226770be399563e2144ec1 to your computer and use it in GitHub Desktop.
Limpia caché en laravel con una llamada HTTP en Laravel
<?php
use Illuminate\Support\Facades\Artisan;
// version optimizada de limpieza de cache
Route::get('/clear-cache', function () {
Artisan::call('optimize:clear');
return '<script>window.location.href="/"</script>';
});
<?php
use Illuminate\Support\Facades\Artisan;
Route::get('/clear-cache', function () {
Artisan::call('cache:clear');
Artisan::call('route:clear');
Artisan::call('config:cache');
Artisan::call('view:clear');
// setea nuevamente el cache
Artisan::call('config:cache');
Artisan::call('route:cache');
Artisan::call('view:cache');
return "Cache limpiado exitósamente";
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment