mirror of
https://gitee.com/ctexthuang/hyperf_rbac_framework_server_ctexthuang.git
synced 2025-12-25 19:27:48 +08:00
51 lines
1.0 KiB
PHP
51 lines
1.0 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Command\GenClass;
|
|
|
|
use Hyperf\Command\Annotation\Command;
|
|
use Hyperf\Devtool\Generator\GeneratorCommand;
|
|
use Psr\Container\ContainerInterface;
|
|
|
|
#[Command]
|
|
class ServiceGenCommand extends GeneratorCommand
|
|
{
|
|
/**
|
|
* @param ContainerInterface $container
|
|
*/
|
|
public function __construct(protected ContainerInterface $container)
|
|
{
|
|
parent::__construct('gen:service');
|
|
}
|
|
|
|
/**
|
|
* @return void
|
|
*/
|
|
public function configure(): void
|
|
{
|
|
parent::configure();
|
|
$this->setDescription('Create a new service class');
|
|
|
|
$this->setHelp('php bin/hyperf.php gen:service /folder/fileService');
|
|
}
|
|
|
|
/**
|
|
* 获取 stubs
|
|
* @return string
|
|
*/
|
|
protected function getStub(): string
|
|
{
|
|
return __DIR__ . '/stubs/service.stub';
|
|
}
|
|
|
|
/**
|
|
* 获取默认命名空间
|
|
* @return string
|
|
*/
|
|
protected function getDefaultNamespace(): string
|
|
{
|
|
return 'App\\Service';
|
|
}
|
|
}
|