Running Console Command from Subfolder

Posted 4 months ago by timgavin

I created a command in a subfolder...

php artisan make:command MyCommands/CommandOne

And I edited it...

<?php

namespace App\Console\Commands\MyCommands;

use Illuminate\Console\Command;

class CommandOne extends Command
{
    protected $signature = 'my:command';

    protected $description = 'Testing it out';

    public function __construct()
    {
        parent::__construct();
    }

    public function handle()
    {
        $this->info('It works!');
    }
}

I then ran it...

my:command

and got an error:

bash: my:command: command not found

How do I run a command in a sub-folder?

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.