diff --git a/cli/valet.php b/cli/valet.php index 965d53b70..ac1903a9c 100755 --- a/cli/valet.php +++ b/cli/valet.php @@ -234,38 +234,80 @@ /** * Start the daemon services. */ - $app->command('start', function () { - DnsMasq::restart(); - - PhpFpm::restart(); - - Nginx::restart(); + $app->command('start [service]', function ($service) { + switch ($service) { + case '': + DnsMasq::restart(); + PhpFpm::restart(); + Nginx::restart(); + + return info('Valet services have been started.'); + case 'dnsmasq': + DnsMasq::restart(); + + return info('dnsmasq has been started.'); + case 'nginx': + Nginx::restart(); + + return info('Nginx has been started.'); + case 'php': + PhpFpm::restart(); + + return info('PHP has been started.'); + } - info('Valet services have been started.'); + return warning(sprintf('Invalid valet service name [%s]', $service)); })->descriptions('Start the Valet services'); /** * Restart the daemon services. */ - $app->command('restart', function () { - DnsMasq::restart(); - - PhpFpm::restart(); - - Nginx::restart(); - - info('Valet services have been restarted.'); + $app->command('restart [service]', function ($service) { + switch ($service) { + case '': + DnsMasq::restart(); + PhpFpm::restart(); + Nginx::restart(); + + return info('Valet services have been restarted.'); + case 'dnsmasq': + DnsMasq::restart(); + + return info('dnsmasq has been restarted.'); + case 'nginx': + Nginx::restart(); + + return info('Nginx has been restarted.'); + case 'php': + PhpFpm::restart(); + + return info('PHP has been restarted.'); + } + + return warning(sprintf('Invalid valet service name [%s]', $service)); })->descriptions('Restart the Valet services'); /** * Stop the daemon services. */ - $app->command('stop', function () { - PhpFpm::stopRunning(); - - Nginx::stop(); + $app->command('stop [service]', function ($service) { + switch ($service) { + case '': + PhpFpm::stopRunning(); + Nginx::stop(); + + return info('Valet services have been stopped.'); + case 'nginx': + Nginx::stop(); + + return info('Nginx has been stopped.'); + case 'php': + PhpFpm::stopRunning(); + + return info('PHP has been stopped.'); + } - info('Valet services have been stopped.'); + return warning(sprintf('Invalid valet service name [%s]', $service)); })->descriptions('Stop the Valet services'); /**