t0berius's avatar

laravel5.3 register console command

I've cerated a new Command using artisan:

php artisan make:command CheckUsers

Now a file located at "Console/Commands/CheckUsers.php" was created.

How to insert this file now to the list of commands of artisan (when I call php artisan -help, it's not listed). I figured out I would need to add this command into the "routes/console.php" file, but I don't understand how to do this.

Here's the current code of my console.php

Artisan::command('inspire', function () {
    $this->comment(Inspiring::quote());
})->describe('Display an inspiring quote');

//how to insert here now my command (check:users)
Artisan::command();
0 likes
2 replies
rwdevguy's avatar

Just to follow on from @bestmono's answer.

If you've used php artisan make:command this will create a class in your app/Console/Commands directory. To register this you should just need to add the class to the $commands array in your app/Console/Kernel.php class.

As far as I'm aware the routes/console.php file is for when you just want to create a quick commands in a closure (kind of like when you might use a closure for a route instead of referencing a method in a controller).

Hope this helps!

Please or to participate in this conversation.