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