Viewing file: CommandMakeCommand.php (1.37 KB) -rw-rw-rw- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
namespace Webkul\PackageGenerator\Console\Command;
use Symfony\Component\Console\Attribute\AsCommand;
#[AsCommand(name: 'package:make-command')] class CommandMakeCommand extends MakeCommand { /** * The name and signature of the console command. * * @var string */ protected $signature = 'package:make-command {name} {package} {--force}';
/** * The type of class being generated. * * @var string */ protected $type = 'Console command';
/** * The console command description. * * @var string|null */ protected $description = 'Create a new command.';
/** * Get the stub file for the generator. */ protected function getStubContents(): string { return $this->packageGenerator->getStubContents('command', $this->getStubVariables()); }
/** * Get the stub variables. */ protected function getStubVariables(): array { return [ 'NAMESPACE' => $this->getClassNamespace($this->argument('package').'/Console/Commands'), 'CLASS' => $this->getClassName(), ]; }
/** * Get the source file path. */ protected function getSourceFilePath(): string { $path = base_path('packages/'.$this->argument('package')).'/src/Console/Commands';
return "$path/{$this->getClassName()}.php"; } }
|