make(Illuminate\Contracts\Console\Kernel::class); try { // Run the Artisan command 'ping' $exitCode = $kernel->call('schedule:run'); // Get the output of the command $output = $kernel->output(); echo "Artisan command 'schedule:run' executed successfully. Exit code: $exitCode\n"; echo "Output:\n$output"; } catch (\Exception $e) { echo 'Error running Artisan command: '.$e->getMessage(); }