-
-
Save mishajib/fae0ab003231cd08ef5e7b7a06846ad4 to your computer and use it in GitHub Desktop.
Laravel Cache Clear
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Route::get('artisan/command/{key?}', array(function($key = null) | |
{ | |
Artisan::call('config:clear'); | |
if($key == "cache-clear") | |
{ | |
try | |
{ | |
echo '<br>php artisan cache:clear...'; | |
Artisan::call('cache:clear'); | |
echo '<br>php artisan cache:clear completed'; | |
} | |
catch (Exception $e) { | |
Response::make($e->getMessage(), 500); | |
} | |
} | |
elseif($key == "view-clear") | |
{ | |
try | |
{ | |
echo '<br>php artisan view:clear...'; | |
Artisan::call('view:clear'); | |
echo '<br>php artisan view:clear completed'; | |
} | |
catch (Exception $e) | |
{ | |
Response::make($e->getMessage(), 500); | |
} | |
} | |
else | |
{ | |
App::abort(404); | |
} | |
} | |
)); | |
//Clear Cache facade value: | |
Route::get('/clear-cache', function() { | |
$exitCode = Artisan::call('cache:clear'); | |
return '<h1>Cache facade value cleared</h1>'; | |
}); | |
//Reoptimized class loader: | |
Route::get('/optimize', function() { | |
$exitCode = Artisan::call('optimize'); | |
return '<h1>Reoptimized class loader</h1>'; | |
}); | |
//Route cache: | |
Route::get('/route-cache', function() { | |
$exitCode = Artisan::call('route:cache'); | |
return '<h1>Routes cached</h1>'; | |
}); | |
//Clear Route cache: | |
Route::get('/route-clear', function() { | |
$exitCode = Artisan::call('route:clear'); | |
return '<h1>Route cache cleared</h1>'; | |
}); | |
//Clear View cache: | |
Route::get('/view-clear', function() { | |
$exitCode = Artisan::call('view:clear'); | |
return '<h1>View cache cleared</h1>'; | |
}); | |
//Clear Config cache: | |
Route::get('/config-cache', function() { | |
$exitCode = Artisan::call('config:cache'); | |
return '<h1>Clear Config cleared</h1>'; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment