如何创建laravel artisan命令?

I want to create the commands order:process and order:lock. So far, I have figured out that I need to run php artisan command:make process --namespace=order to create the order:process class file. Then I need to set the $name value in the app/commands/process.php to 'order:process'. This is where I'm stuck.

I think I need to add something to app/start/artisan.php to make the command usable, but I can't figure out what. I've tried Artisan::add(new order\process); and Artisan::add(new process);, but neither of these work. What do I need to do, to get my new commands available to be run from the command line? I know the problem is to do with the use of a namespace, but I can't find any documentation on artisan commands that use namespaces.

I still have no idea how to use namespaces, but I have figured this part out.

The answer is, to use php artisan command:make orderProcessCommand, and register that with Artisan::add(new orderProcessCommand);. The in orderProcessCommand.php, set the $name to order:process. Artisan will read the class as directed by the registration command, but make it available to be called as described in the $name field.

First create them with artisan command

php artisan command:make OrderProcessCommand --command=order:process
php artisan command:make OrderLockCommand --command=order:lock

Edit your commands located in app/commands

Then register your commands in app/start/artisan.php

Artisan::add(new OrderProcessCommand);
Artisan::add(new OrderLockCommand);

For laravel 5.0

php artisan make:console Foo --command=foo:do

Edit your commands located in app/Console/Commands/Foo.php

Then register your commands by adding an entry to app/Console/Kernel.php

protected $commands = [
    'Cloudlite\Console\Commands\Inspire',
    'Cloudlite\Console\Commands\EmailParser',
    'Cloudlite\Console\Commands\Foo',
];

You can now run like the following (example default option, edit Foo.php)

php artisan foo:do example=1