FactoryMakeCommand
class FactoryMakeCommand extends GeneratorCommand (View source)
Трейты
| CallsCommands | |
| ConfiguresPrompts | |
| HasParameters | |
| InteractsWithIO | |
| InteractsWithSignals | |
| PromptsForMissingInput | |
| Macroable |
Свойства
| protected Factory internal | $components | The console components factory. | from InteractsWithIO |
| protected InputInterface | $input | The input interface implementation. | from InteractsWithIO |
| protected OutputStyle | $output | The output interface implementation. | from InteractsWithIO |
| protected int | $verbosity | The default verbosity of output commands. | from InteractsWithIO |
| protected array | $verbosityMap | The mapping between human readable verbosity levels and Symfony's OutputInterface. | from InteractsWithIO |
| protected Signals|null | $signals | The signal registrar instance. | from InteractsWithSignals |
| static protected array | $macros | The registered string macros. | from Macroable |
| protected Application | $laravel | The Laravel application instance. | from Command |
| protected string | $signature | The name and signature of the console command. | from Command |
| protected string | $name | The console command name. | |
| protected string | $description | The console command description. | |
| protected string | $help | The console command help text. | from Command |
| $hidden | Indicates whether the command should be shown in the Artisan command list. | from Command | |
| protected bool | $isolated | Indicates whether only one instance of the command can run at any given time. | from Command |
| protected int | $isolatedExitCode | The default exit code for isolated commands. | from Command |
| protected array | $aliases | The console command name aliases. | from Command |
| protected Filesystem | $files | The filesystem instance. | from GeneratorCommand |
| protected string | $type | The type of class being generated. | |
| protected string[] | $reservedNames | Reserved names that cannot be used for generation. | from GeneratorCommand |
Методы
| Команда | resolveCommand(Command|string $command)
Разрешить экземпляр консольной команды для заданной команды. | из CallsCommands |
| int | call(Command|string $command, array $arguments = [])
Вызвать другую консольную команду. | из CallsCommands |
| int | callSilent(Command|string $command, array $arguments = [])
Вызвать другую консольную команду без вывода. | из CallsCommands |
| int | callSilently(Command|string $command, array $arguments = [])
Вызвать другую консольную команду без вывода. | из CallsCommands |
| int | runCommand(Command|string $command, array $arguments, OutputInterface $output)
Выполнить заданную консольную команду. | из CallsCommands |
| ArrayInput | createInputFromArguments(array $arguments)
Создать экземпляр ввода из заданных аргументов. | из CallsCommands |
| массив | context()
Получить весь контекст, переданный команде. | из CallsCommands |
| void | configurePrompts(InputInterface $input)
Настроить резервные варианты подсказок. | из ConfiguresPrompts |
| смешанный | promptUntilValid(Closure $prompt, bool|string $required, Closure|null $validate)
Запрашивать у пользователя данные до тех пор, пока не будет выполнено указанное условие проверки. | из ConfiguresPrompts |
| void | restorePrompts()
Восстановить вывод подсказок. | из ConfiguresPrompts |
| void | specifyParameters()
Указать аргументы и параметры команды. | из HasParameters |
| массив | getArguments()
Получить аргументы консольной команды. | из HasParameters |
| массив | getOptions()
Получить параметры консольной команды. | |
| bool | hasArgument(string|int $name)
Определить, присутствует ли заданный аргумент. | из InteractsWithIO |
| массив|строка|bool|null | argument(string|null $key = null)
Получить значение аргумента команды. | из InteractsWithIO |
| массив | arguments()
Получить все аргументы, переданные команде. | из InteractsWithIO |
| bool | hasOption(string $name)
Определить, присутствует ли заданный параметр. | из InteractsWithIO |
| строка|массив|bool|null | option(string|null $key = null)
Получить значение параметра команды. | из InteractsWithIO |
| массив | options()
Получить все параметры, переданные команде. | |
| bool | confirm(string $question, bool $default = false)
Подтвердить вопрос у пользователя. | из InteractsWithIO |
| смешанный | ask(string $question, string|null $default = null)
Задать вопрос пользователю. | из InteractsWithIO |
| смешанный | anticipate(string $question, array|callable $choices, string|null $default = null)
Задать вопрос пользователю с автодополнением. | из InteractsWithIO |
| смешанный | askWithCompletion(string $question, array|callable $choices, string|null $default = null)
Задать вопрос пользователю с автодополнением. | из InteractsWithIO |
| смешанный | secret(string $question, bool $fallback = true)
Задать вопрос пользователю, скрыв ответ в консоли. | из InteractsWithIO |
| строка|массив | choice(string $question, array $choices, string|int|null $default = null, mixed|null $attempts = null, bool $multiple = false)
Предложить пользователю выбор из массива ответов. | из InteractsWithIO |
| void | table(array $headers, Arrayable|array $rows, TableStyle|string $tableStyle = 'default', array $columnStyles = [])
Форматировать ввод в текстовую таблицу. | из InteractsWithIO |
| смешанный|void | withProgressBar(iterable|int $totalSteps, Closure $callback)
Выполнить заданный обратный вызов с полосой прогресса. | из InteractsWithIO |
| void | info(string $string, int|string|null $verbosity = null)
Вывести строку в качестве информационного вывода. | из InteractsWithIO |
| void | line(string $string, string|null $style = null, int|string|null $verbosity = null)
Вывести строку в стандартный вывод. | из InteractsWithIO |
| void | comment(string $string, int|string|null $verbosity = null)
Вывести строку как комментарий. | из InteractsWithIO |
| void | question(string $string, int|string|null $verbosity = null)
Вывести строку как вопрос. | из InteractsWithIO |
| void | error(string $string, int|string|null $verbosity = null)
Вывести строку как ошибку. | из InteractsWithIO |
| void | warn(string $string, int|string|null $verbosity = null)
Вывести строку как предупреждение. | из InteractsWithIO |
| void | alert(string $string, int|string|null $verbosity = null)
Вывести строку в окне уведомления. | из InteractsWithIO |
| $this | newLine(int $count = 1)
Напечатать пустую строку. | из InteractsWithIO |
| void | setInput(InputInterface $input)
Установить реализацию интерфейса ввода. | из InteractsWithIO |
| void | setOutput(OutputStyle $output)
Установить реализацию интерфейса вывода. | из InteractsWithIO |
| void | setVerbosity(string|int $level)
Установить уровень подробности. | из InteractsWithIO |
| int | parseVerbosity(string|int|null $level = null)
Получить уровень подробности в терминах уровня OutputInterface Symfony. | из InteractsWithIO |
| OutputStyle | getOutput()
Получить реализацию вывода. | из InteractsWithIO |
| Factory | outputComponents()
Получить реализацию фабрики компонентов вывода. | из InteractsWithIO |
| trap($signals, $callback) Без описания | из InteractsWithSignals | |
| void | untrap()
Отменить обработчики сигналов, установленные в обработчике команды. | из InteractsWithSignals |
| void | interact(InputInterface $input, OutputInterface $output)
Взаимодействовать с пользователем перед проверкой ввода. | из PromptsForMissingInput |
| void | promptForMissingArguments(InputInterface $input, OutputInterface $output)
Запросить у пользователя отсутствующие аргументы. | из PromptsForMissingInput |
| array | promptForMissingArgumentsUsing()
Запросить отсутствующие аргументы ввода, используя возвращенные вопросы. | из PromptsForMissingInput |
| void | afterPromptingForMissingArguments(InputInterface $input, OutputInterface $output)
Выполнить действия после того, как пользователя попросили предоставить недостающие аргументы. | из PromptsForMissingInput |
| bool | didReceiveOptions(InputInterface $input)
Содержит ли входной параметр какие-либо параметры, отличные от значений по умолчанию. | из PromptsForMissingInput |
| static void | macro(string $name, object|callable $macro)
Зарегистрировать пользовательское макро. | из Macroable |
| static void | mixin(object $mixin, bool $replace = true)
Смешать другой объект в класс. | из Macroable |
| static bool | hasMacro(string $name)
Проверка, зарегистрировано ли макро. | из Macroable |
| static void | flushMacros()
Очистить существующие макросы. | из Macroable |
| static mixed | __callStatic(string $method, array $parameters)
Динамически обработать вызовы класса. | из Macroable |
| mixed | __call(string $method, array $parameters)
Динамически обработать вызовы класса. | из Macroable |
| void | __construct(Filesystem $files)
Создать новый экземпляр команды создания контроллера. | из GeneratorCommand |
| void | configureUsingFluentDefinition()
Настроить команду консоли с помощью определения fluent. | из Command |
| void | configureIsolation()
Настроить консольную команду для изоляции. | from Command |
| int | run(InputInterface $input, OutputInterface $output)
Запустить консольную команду. | from Command |
| int | execute(InputInterface $input, OutputInterface $output)
Выполнить консольную команду. | from Command |
| CommandMutex | commandIsolationMutex()
Получить экземпляр мьютекса изоляции команды для команды. | from Command |
| bool | isHidden() {@inheritdoc} | from Command |
| Command | setHidden(bool $hidden = true) {@inheritdoc} | from Command |
| Application | getLaravel()
Получить экземпляр приложения Laravel. | from Command |
| void | setLaravel(Container $laravel)
Установить экземпляр приложения Laravel. | from Command |
| string | getStub()
Получить шаблонный файл для генератора. | |
| bool|null | handle()
Выполнить консольную команду. | from GeneratorCommand |
| string | qualifyClass(string $name)
Разбор имени класса и форматирование в соответствии с корневым пространством имен. | from GeneratorCommand |
| string | qualifyModel(string $model)
Квалифицировать заданное базовое имя класса модели. | from GeneratorCommand |
| array<int,string> | possibleModels()
Получить список возможных имен моделей. | from GeneratorCommand |
| array<int,string> | possibleEvents()
Получить список возможных имён событий. | from GeneratorCommand |
| string | getDefaultNamespace(string $rootNamespace)
Получить пространство имён по умолчанию для класса. | from GeneratorCommand |
| bool | alreadyExists(string $rawName)
Определить, существует ли класс. | from GeneratorCommand |
| string | getPath(string $name)
Получить путь назначения класса. | |
| string | makeDirectory(string $path)
Создать директорию для класса, если необходимо. | from GeneratorCommand |
| string | buildClass(string $name)
Создать класс с заданным именем. | |
| $this | replaceNamespace(string $stub, string $name)
Заменить пространство имён для данного шаблона. | from GeneratorCommand |
| string | getNamespace(string $name)
Получить полное пространство имён для данного класса без имени класса. | from GeneratorCommand |
| string | replaceClass(string $stub, string $name)
Заменить имя класса для данного шаблона. | from GeneratorCommand |
| string | sortImports(string $stub)
Сортирует импорты для данного шаблона в алфавитном порядке. | from GeneratorCommand |
| string | getNameInput()
Получить желаемое имя класса из ввода. | from GeneratorCommand |
| string | rootNamespace()
Получить корневое пространство имён для класса. | from GeneratorCommand |
| string|null | userProviderModel()
Получить модель для поставщика пользователей по умолчанию. | from GeneratorCommand |
| bool | isReservedName(string $name)
Проверяет, является ли данное имя зарезервированным. | from GeneratorCommand |
| string | viewPath(string $path = '')
Получить первый путь к каталогу представлений из конфигурации приложения. | from GeneratorCommand |
| string | resolveStubPath(string $stub)
Получить полностью квалифицированный путь к шаблону. | |
| string | guessModelName(string $name)
Определить имя модели по имени Фабрики или вернуть имя модели по умолчанию. |
Details
abstract protected Command resolveCommand(Command|string $command)
Разрешить экземпляр консольной команды для заданной команды.
int call(Command|string $command, array $arguments = [])
Вызвать другую команду консоли.
int callSilent(Command|string $command, array $arguments = [])
Вызвать другую команду консоли без вывода.
int callSilently(Command|string $command, array $arguments = [])
Вызвать другую команду консоли без вывода.
protected int runCommand(Command|string $command, array $arguments, OutputInterface $output)
Выполнить заданную команду консоли.
protected ArrayInput createInputFromArguments(array $arguments)
Создать экземпляр ввода из заданных аргументов.
protected array context()
Получить весь контекст, переданный команде.
protected void configurePrompts(InputInterface $input)
Настроить подсказки.
protected mixed promptUntilValid(Closure $prompt, bool|string $required, Closure|null $validate)
Запрашивать у пользователя данные, пока не будет выполнено заданное условие валидации.
protected void restorePrompts()
Восстановить вывод подсказок.
protected void specifyParameters()
Указать аргументы и параметры команды.
protected array getArguments()
Получить аргументы команды консоли.
protected array getOptions()
Получить параметры команды консоли.
bool hasArgument(string|int $name)
Определить, присутствует ли данный аргумент.
array|string|bool|null argument(string|null $key = null)
Получить значение аргумента команды.
array arguments()
Получить все аргументы, переданные команде.
bool hasOption(string $name)
Определить, присутствует ли данный параметр.
string|array|bool|null option(string|null $key = null)
Получить значение параметра команды.
array options()
Получить все параметры, переданные команде.
bool confirm(string $question, bool $default = false)
Подтвердить вопрос у пользователя.
mixed ask(string $question, string|null $default = null)
Запросить ввод у пользователя.
mixed anticipate(string $question, array|callable $choices, string|null $default = null)
Запросить у пользователя ввод с автодополнением.
mixed askWithCompletion(string $question, array|callable $choices, string|null $default = null)
Запросить у пользователя ввод с автодополнением.
mixed secret(string $question, bool $fallback = true)
Запросить у пользователя ввод, но скрыть ответ от консоли.
string|array choice(string $question, array $choices, string|int|null $default = null, mixed|null $attempts = null, bool $multiple = false)
Предложить пользователю единственный выбор из массива ответов.
void table(array $headers, Arrayable|array $rows, TableStyle|string $tableStyle = 'default', array $columnStyles = [])
Форматировать ввод в текстовую таблицу.
mixed|void withProgressBar(iterable|int $totalSteps, Closure $callback)
Выполнить заданный обратный вызов, одновременно продвигая полосу прогресса.
void info(string $string, int|string|null $verbosity = null)
Вывести строку как информацию.
void line(string $string, string|null $style = null, int|string|null $verbosity = null)
Вывести строку в стандартный вывод.
void comment(string $string, int|string|null $verbosity = null)
Вывести строку как комментарий.
void question(string $string, int|string|null $verbosity = null)
Вывести строку как вопрос.
void error(string $string, int|string|null $verbosity = null)
Вывести строку как ошибку.
void warn(string $string, int|string|null $verbosity = null)
Вывести строку как предупреждение.
void alert(string $string, int|string|null $verbosity = null)
Вывести строку в информационном окне.
$this newLine(int $count = 1)
Напечатать пустую строку.
void setInput(InputInterface $input)
Установить реализацию интерфейса ввода.
void setOutput(OutputStyle $output)
Установить реализацию интерфейса вывода.
protected void setVerbosity(string|int $level)
Установить уровень подробности.
protected int parseVerbosity(string|int|null $level = null)
Получить уровень подробности с точки зрения уровня OutputInterface Symfony.
OutputStyle getOutput()
Получить реализацию вывода.
Factory outputComponents()
Получить реализацию фабрики компонентов вывода.
trap($signals, $callback)
Без описания
void untrap()
| internal |
Отменить обработчики сигналов, установленные в обработчике команды.
protected void interact(InputInterface $input, OutputInterface $output)
Взаимодействие с пользователем перед валидацией ввода.
protected void promptForMissingArguments(InputInterface $input, OutputInterface $output)
Запрос у пользователя недостающих аргументов.
protected array promptForMissingArgumentsUsing()
Запрос недостающих аргументов ввода, используя возвращённые вопросы.
protected void afterPromptingForMissingArguments(InputInterface $input, OutputInterface $output)
Выполнение действий после запроса недостающих аргументов у пользователя.
protected bool didReceiveOptions(InputInterface $input)
Указывает, содержит ли ввод параметры, отличные от стандартных значений.
static void macro(string $name, object|callable $macro)
Регистрирует пользовательскую макрокоманду.
static void mixin(object $mixin, bool $replace = true)
Встраивает другой объект в класс.
static bool hasMacro(string $name)
Проверяет, зарегистрирована ли макрокоманда.
static void flushMacros()
Очищает существующие макрокоманды.
static mixed __callStatic(string $method, array $parameters)
Динамически обрабатывает вызовы класса.
mixed __call(string $method, array $parameters)
Динамически обрабатывает вызовы класса.
void __construct(Filesystem $files)
Создает новый экземпляр команды создания контроллера.
protected void configureUsingFluentDefinition()
Настройка команды консоли с помощью определения Fluent.
protected void configureIsolation()
Настройка команды консоли для изоляции.
int run(InputInterface $input, OutputInterface $output)
Запуск команды консоли.
protected int execute(InputInterface $input, OutputInterface $output)
Выполнение команды консоли.
protected CommandMutex commandIsolationMutex()
Получение экземпляра мьютекса изоляции команды.
bool isHidden()
{@inheritdoc}
Command setHidden(bool $hidden = true)
{@inheritdoc}
Application getLaravel()
Получение экземпляра приложения Laravel.
void setLaravel(Container $laravel)
Установить экземпляр приложения Laravel.
protected string getStub()
Получить шаблонный файл для генератора.
bool|null handle()
Выполнить командную строку.
protected string qualifyClass(string $name)
Обработать имя класса и отформатировать его в соответствии с корневым пространством имен.
protected string qualifyModel(string $model)
Определить имя переданного класса модели.
protected array<int,string> possibleModels()
Получить список возможных имен моделей.
protected array<int,string> possibleEvents()
Получить список возможных имен событий.
protected string getDefaultNamespace(string $rootNamespace)
Получить пространство имен по умолчанию для класса.
protected bool alreadyExists(string $rawName)
Определить, существует ли класс.
protected string getPath(string $name)
Получить путь назначения класса.
protected string makeDirectory(string $path)
Создать директорию для класса, если необходимо.
protected string buildClass(string $name)
Создать класс с заданным именем.
protected $this replaceNamespace(string $stub, string $name)
Заменить пространство имен для данного шаблона.
protected string getNamespace(string $name)
Получить полное пространство имен для данного класса, без имени класса.
protected string replaceClass(string $stub, string $name)
Заменить имя класса для данного шаблона.
protected string sortImports(string $stub)
Сортирует импорты для данного шаблона в алфавитном порядке.
protected string getNameInput()
Получить желаемое имя класса из ввода.
protected string rootNamespace()
Получить корневое пространство имен для класса.
protected string|null userProviderModel()
Получить модель для поставщика пользователей по умолчанию.
protected bool isReservedName(string $name)
Проверяет, является ли данное имя зарезервированным.
protected string viewPath(string $path = '')
Получить путь к первому каталогу представлений из конфигурации приложения.
protected string resolveStubPath(string $stub)
Разрешить полностью квалифицированный путь к шаблону.
protected string guessModelName(string $name)
Угадать имя модели по имени фабрики или вернуть имя модели по умолчанию.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/10.x/Illuminate/Database/Console/Factories/FactoryMakeCommand.html