Skip to content
Advertisement

how to Abort/exit/stop/terminate in laravel console command using code

Let’s say I’m coding a command. How would I stop it completely in the middle of it running?

Example:

JavaScript

I have tried:

JavaScript

But that dumps a bunch of ugliness in the terminal.

Advertisement

Answer

Just use a return statement instead of throwing an exception. Like…

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement