I'm trying to create a command that generates a class in the Services directory using the make:service command in Laravel 8. I followed the steps of this post.
class ServiceMakeCommand extends GeneratorCommand
{
protected $name = 'make:service';
protected $signature = 'make:service {name: Create your own service}';
protected $description = 'Create a service for repository pattern';
protected $type = 'Service';
protected function getStub()
{
return app_path('Console/Stubs/service.stub');
}
protected function getDefaultNamespace($rootNamespace)
{
return $rootNamespace . '\Services';
}
}
Also, I create my template stub.
<?php
namespace App\Service;
class DummyClass
{
}
But I get this error when I try to run this command.
php artisan make:service ProductService
Error
The "name" argument does not exist.
What does it mean?