PATH:
home
/
lab2454c
/
costbloc.com
/
vendor
/
nwidart
/
laravel-modules
/
src
/
Commands
<?php namespace Nwidart\Modules\Commands; use Illuminate\Console\Command; use Nwidart\Modules\Exceptions\FileAlreadyExistException; use Nwidart\Modules\Generators\FileGenerator; abstract class GeneratorCommand extends Command { /** * The name of 'name' argument. * * @var string */ protected $argumentName = ''; /** * Get template contents. * * @return string */ abstract protected function getTemplateContents(); /** * Get the destination file path. * * @return string */ abstract protected function getDestinationFilePath(); /** * Execute the console command. */ public function handle() : int { $path = str_replace('\\', '/', $this->getDestinationFilePath()); if (!$this->laravel['files']->isDirectory($dir = dirname($path))) { $this->laravel['files']->makeDirectory($dir, 0777, true); } $contents = $this->getTemplateContents(); try { $overwriteFile = $this->hasOption('force') ? $this->option('force') : false; (new FileGenerator($path, $contents))->withFileOverwrite($overwriteFile)->generate(); $this->info("Created : {$path}"); } catch (FileAlreadyExistException $e) { $this->error("File : {$path} already exists."); return E_ERROR; } return 0; } /** * Get class name. * * @return string */ public function getClass() { return class_basename($this->argument($this->argumentName)); } /** * Get default namespace. * * @return string */ public function getDefaultNamespace() : string { return ''; } /** * Get class namespace. * * @param \Nwidart\Modules\Module $module * * @return string */ public function getClassNamespace($module) { $extra = str_replace($this->getClass(), '', $this->argument($this->argumentName)); $extra = str_replace('/', '\\', $extra); $namespace = $this->laravel['modules']->config('namespace'); $namespace .= '\\' . $module->getStudlyName(); $namespace .= '\\' . $this->getDefaultNamespace(); $namespace .= '\\' . $extra; $namespace = str_replace('/', '\\', $namespace); return trim($namespace, '\\'); } }
[-] SeedCommand.php
[edit]
[-] DisableCommand.php
[edit]
[-] MigrateResetCommand.php
[edit]
[-] SeedMakeCommand.php
[edit]
[-] MigrateRollbackCommand.php
[edit]
[-] MailMakeCommand.php
[edit]
[-] RouteProviderMakeCommand.php
[edit]
[-] LaravelModulesV6Migrator.php
[edit]
[+]
..
[-] ListCommand.php
[edit]
[-] CommandMakeCommand.php
[edit]
[-] NotificationMakeCommand.php
[edit]
[-] FactoryMakeCommand.php
[edit]
[-] ComponentViewMakeCommand.php
[edit]
[-] SetupCommand.php
[edit]
[-] ResourceMakeCommand.php
[edit]
[-] MigrateRefreshCommand.php
[edit]
[-] PublishTranslationCommand.php
[edit]
[-] MigrateStatusCommand.php
[edit]
[-] ModuleMakeCommand.php
[edit]
[-] ComponentClassMakeCommand.php
[edit]
[-] UpdateCommand.php
[edit]
[-] UseCommand.php
[edit]
[-] PublishMigrationCommand.php
[edit]
[-] RequestMakeCommand.php
[edit]
[-] MigrateFreshCommand.php
[edit]
[-] MigrationMakeCommand.php
[edit]
[-] PublishCommand.php
[edit]
[-] MigrateCommand.php
[edit]
[-] TestMakeCommand.php
[edit]
[-] ModuleDeleteCommand.php
[edit]
[-] RuleMakeCommand.php
[edit]
[-] PolicyMakeCommand.php
[edit]
[-] EnableCommand.php
[edit]
[-] ListenerMakeCommand.php
[edit]
[-] MiddlewareMakeCommand.php
[edit]
[-] InstallCommand.php
[edit]
[-] DumpCommand.php
[edit]
[-] PublishConfigurationCommand.php
[edit]
[-] ModelMakeCommand.php
[edit]
[-] ProviderMakeCommand.php
[edit]
[-] EventMakeCommand.php
[edit]
[-] JobMakeCommand.php
[edit]
[-] GeneratorCommand.php
[edit]
[+]
stubs
[-] ControllerMakeCommand.php
[edit]
[-] UnUseCommand.php
[edit]