run artisan command usinf route laravel code example
Example: execute artisan command from route
Route::get('clear_cache', function () {
\Artisan::call('cache:clear');
dd("Cache is cleared");
});
Route::get('clear_cache', function () {
\Artisan::call('cache:clear');
dd("Cache is cleared");
});