diff --git a/app/Ship/Commands/CreateObserverCommand.php b/app/Ship/Commands/CreateObserverCommand.php new file mode 100644 index 0000000..eefe9fa --- /dev/null +++ b/app/Ship/Commands/CreateObserverCommand.php @@ -0,0 +1,89 @@ +writeFile( + [str_replace('/', DIRECTORY_SEPARATOR, Rudra::config()->get('app.path') . "/app/Containers/$container/Observers/"), "{$className}.php"], + $this->createClass($className, $container) + ); + + } else { + $this->actionIndex(); + } + } + + /** + * @param string $className + * @param string $container + * @return string + * + * Creates class data + * ------------------ + * Создает данные класса + */ + private function createClass(string $className, string $container) + { + return <<eventRegistration(); +Cli::addCommand("create:observer", [App\Ship\Commands\CreateObserverCommand::class]); +Cli::addCommand("cr:ob", [App\Ship\Commands\CreateObserverCommand::class]); + Cli::addCommand("create:repository", [App\Ship\Commands\CreateRepositoryCommand::class]); Cli::addCommand("cr:r", [App\Ship\Commands\CreateRepositoryCommand::class]);