feat: command
Some checks are pending
Build Docker / build (push) Waiting to run

This commit is contained in:
2024-10-26 18:27:45 +08:00
parent d15c03c04e
commit 3a39ff3790
12 changed files with 346 additions and 1 deletions

View File

@@ -0,0 +1,49 @@
<?php
namespace App\Command;
use Hyperf\Command\Annotation\Command;
use Hyperf\Devtool\Generator\GeneratorCommand;
use Psr\Container\ContainerInterface;
#[Command]
class ServiceCommand extends GeneratorCommand
{
/**
* 构造方法
* @param ContainerInterface $container
*/
public function __construct(protected ContainerInterface $container)
{
parent::__construct('gen:service');
}
/**
* 生成
* @return void
*/
public function configure(): void
{
$this->setDescription('Create a new service class');
parent::configure();
}
/**
* 获取stub文件
* @return string
*/
protected function getStub(): string
{
return __DIR__ . '/stubs/service.stub';
}
/**
* 获取默认命名空间
* @return string
*/
protected function getDefaultNamespace(): string
{
return 'App\\Service';
}
}