I'm using Laravel 8.2 and have created a custom command using
php artisan make:command GetAssignedUser
When I run 'php artisan list' it doesn't show up. I have tried adding to the $commands array in Kernel.php and it complains of the class already existing. I have since read the docs and can see all commands in the Commands folder are automatically loaded so have also tried without. I have also tried dumping the autoload file.
?php
namespace App\Console\Commands;
namespace App\Client;
use Illuminate\Console\Command;
use App\Models\Client;
class GetAssignedUser extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'client:GetAssignedUser';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Gets allocated user from and send mail notification';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle()
...
Well, there is another solution if you faced the same problem again, In order to list the artisan commands including the custom ones, you have to invoke the systems PHP CLI Interpreter specifically PHP call.
To view a list of all available Artisan commands, you may use the following list command.