Mercurial > packages > magicforger
view src/Generator/Route/RouteGenerator.php @ 5:b0b2e79ad8e6
Not exatly sure what was changed but commiting to it :)
| author | luka |
|---|---|
| date | Thu, 12 Oct 2023 19:41:04 -0400 |
| parents | |
| children | 769a17898cc0 |
line wrap: on
line source
<?php namespace Wizzard\MagicForger\Generator\Route; use Symfony\Component\Console\Attribute\AsCommand; use Wizzard\MagicForger\Generator\BaseGenerator; use Wizzard\MagicForger\Replacer; use Illuminate\Support\Str; #[AsCommand(name: 'mf:routes')] class RouteGenerator extends BaseGenerator { /** * The name and signature of the console command. * * @var string */ protected $name = 'mf:routes'; /** * The console command description. * * @var string */ protected $description = 'Generates the Route File for a table.'; /** * The type of class being generated. * * @var string */ protected $type = 'Route'; /** * Execute the console command. */ public function handle() { parent::handle(); } /** * Get the stub file for the generator. * * @return string */ protected function getStub() { return $this->resolveStubPath('/stubs/routes.stub'); } /** * Resolve the fully-qualified path to the stub. * * @param string $stub * @return string */ protected function resolveStubPath($stub) { return is_file($customPath = $this->laravel->basePath(trim($stub, '/'))) ? $customPath : __DIR__.$stub; } protected function getClassName($name) { return $this->routes_name($name); } /** * Get the stub file for the generator. * * @return string */ protected function getPath($name = null) { return str_replace(['App\\', '\\'], ['app/', '/'], $this->getRouteNamespace() . '/' . $this->routes_name($this->getTableInput()) . '.php'); } }
