Skip to content

Registering Commands

Denis Duliçi edited this page Nov 19, 2019 · 2 revisions

Your module may contain console commands. You can generate these commands manually, or with the following helper:

php artisan module:make-command CreatePostCommand my-blog

This will create a CreatePostCommand file/class under the Blog module. By default, it will be Modules/MyBlog/Console/CreatePostCommand

Check out the Laravel documentation about Artisan commands.

Registering

You can register the command using the Laravel method called commands that is available inside a service provider class.

$this->commands(\Modules\MyBlog\Console\CreatePostCommand::class);

You can now access your command via php artisan in the console.

Clone this wiki locally