Spec-Zone.ru › Laravel 11

DbCommand

класс DbCommand расширяет Command (Просмотреть исходный код)

Трейты

CallsCommands
ConfiguresPrompts
HasParameters
InteractsWithIO
InteractsWithSignals
PromptsForMissingInput
Macroable

Свойства

protected Factory internal $components

Фабрика компонентов консоли.

из InteractsWithIO
protected InputInterface $input

Реализация интерфейса ввода.

из InteractsWithIO
protected OutputStyle $output

Реализация интерфейса вывода.

из InteractsWithIO
protected int $verbosity

Уровень детализации вывода команд по умолчанию.

из InteractsWithIO
protected array $verbosityMap

Сопоставление удобочитаемых уровней детализации с уровнями Symfony OutputInterface.

из InteractsWithIO
protected Signals|null $signals

Экземпляр регистратора сигналов.

из InteractsWithSignals
static protected array $macros

Зарегистрированные макросы строк.

из Macroable
protected Application $laravel

Экземпляр приложения Laravel.

из Command
protected string $signature

Имя и подпись командной строки.

protected string $name

Имя команды консоли.

из Command
protected string $description

Описание команды консоли.

protected string $help

Текст справки команды консоли.

из Command
protected bool $hidden

Указывает, должна ли команда отображаться в списке команд Artisan.

из Command
protected bool $isolated

Указывает, может ли в данный момент выполняться только одна копия команды.

из Command
protected int $isolatedExitCode

Код выхода по умолчанию для изолированных команд.

из Command
protected array $aliases

Псевдонимы имени команды консоли.

из Command

Методы

Команда 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
?string validatePrompt(mixed $value, mixed $rules)

Проверить заданное значение подсказки с помощью валидатора.

из ConfiguresPrompts
Validator getPromptValidatorInstance(mixed $field, mixed $value, mixed $rules, array $messages = [], array $attributes = [])

Получить экземпляр валидатора, который должен использоваться для проверки подсказок.

из ConfiguresPrompts
массив validationMessages()

Получить сообщения об ошибках валидации, которые должны использоваться при проверке подсказок.

из ConfiguresPrompts
массив validationAttributes()

Получить атрибуты валидации, которые должны использоваться при проверке подсказок.

из ConfiguresPrompts
void restorePrompts()

Восстановить вывод подсказок.

из ConfiguresPrompts
void specifyParameters()

Указать аргументы и параметры команды.

из HasParameters
массив getArguments()

Получить аргументы консольной команды.

из HasParameters
массив getOptions()

Получить параметры консольной команды.

из HasParameters
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()

Получить все переданные команде параметры.

из InteractsWithIO
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
string|array 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
mixed|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)

Динамически обрабатывает вызовы к классу.

from Macroable
mixed __call(string $method, array $parameters)

Динамически обрабатывает вызовы к классу.

from Macroable
void __construct()

Создаёт новый экземпляр команды консоли.

from Command
void configureUsingFluentDefinition()

Настраивает команду консоли с помощью определения в стиле fluent.

from 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
void fail(Throwable|string|null $exception = null)

Принудительно завершить команду с ошибкой.

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
int handle()

Выполнить команду консоли.

array getConnection()

Получить конфигурацию подключения к базе данных.

array commandArguments(array $connection)

Получить аргументы для команды клиента базы данных.

array|null commandEnvironment(array $connection)

Получить переменные окружения для команды клиента базы данных.

string getCommand(array $connection)

Получить команду клиента базы данных для выполнения.

array getMysqlArguments(array $connection)

Получить аргументы для MySQL CLI.

array getMariaDbArguments(array $connection)

Получить аргументы для MariaDB CLI.

array getPgsqlArguments(array $connection)

Получить аргументы для Postgres CLI.

array getSqliteArguments(array $connection)

Получить аргументы для SQLite CLI.

array getSqlsrvArguments(array $connection)

Получить аргументы для SQL Server CLI.

array|null getPgsqlEnvironment(array $connection)

Получить переменные окружения для Postgres CLI.

array getOptionalArguments(array $args, array $connection)

Получить необязательные аргументы на основе конфигурации подключения.

Подробности

abstract protected Command resolveCommand(Command|string $command)

Разрешить экземпляр команды консоли для данной команды.

Parameters

Command|string $command

Return Value

Command

int call(Command|string $command, array $arguments = [])

Вызвать другую команду консоли.

Parameters

Command|string $command
array $arguments

Return Value

int

int callSilent(Command|string $command, array $arguments = [])

Вызвать другую команду консоли без вывода.

Parameters

Command|string $command
array $arguments

Return Value

int

int callSilently(Command|string $command, array $arguments = [])

Вызвать другую команду консоли без вывода.

Parameters

Command|string $command
array $arguments

Return Value

int

protected int runCommand(Command|string $command, array $arguments, OutputInterface $output)

Запустить данную команду консоли.

Parameters

Command|string $command
array $arguments
OutputInterface $output

Return Value

int

protected ArrayInput createInputFromArguments(array $arguments)

Создать экземпляр ввода из заданных аргументов.

Parameters

array $arguments

Return Value

ArrayInput

protected array context()

Получить весь контекст, переданный команде.

Return Value

array

protected void configurePrompts(InputInterface $input)

Настроить отступы подсказок.

Параметры

InputInterface $input

Возвращаемое значение

void

protected mixed promptUntilValid(Closure $prompt, bool|string $required, Closure|null $validate)

Запрашивать у пользователя данные до тех пор, пока не будет выполнено указанное обратное вызов валидации.

Параметры

Closure $prompt
bool|string $required
Closure|null $validate

Возвращаемое значение

mixed

protected ?string validatePrompt(mixed $value, mixed $rules)

Проверить значение предоставленной подсказки с помощью валидатора.

Параметры

mixed $value
mixed $rules

Возвращаемое значение

?string

protected Validator getPromptValidatorInstance(mixed $field, mixed $value, mixed $rules, array $messages = [], array $attributes = [])

Получить экземпляр валидатора, который следует использовать для проверки подсказок.

Параметры

mixed $field
mixed $value
mixed $rules
array $messages
array $attributes

Возвращаемое значение

Validator

protected array validationMessages()

Получить сообщения валидации, которые следует использовать во время проверки подсказок.

Возвращаемое значение

array

protected array validationAttributes()

Получить атрибуты валидации, которые следует использовать при проверке подсказок.

Возвращаемое значение

array

protected void restorePrompts()

Восстановить вывод подсказок.

Возвращаемое значение

void

protected void specifyParameters()

Указать аргументы и параметры в команде.

Возвращаемое значение

void

protected array getArguments()

Получить аргументы команды.

Возвращаемое значение

array

protected array getOptions()

Получить параметры команды.

Возвращаемое значение

array

bool hasArgument(string|int $name)

Определить, присутствует ли данный аргумент.

Параметры

string|int $name

Возвращаемое значение

bool

array|string|bool|null argument(string|null $key = null)

Получить значение аргумента команды.

Параметры

string|null $key

Возвращаемое значение

array|string|bool|null

array arguments()

Получить все аргументы, переданные команде.

Возвращаемое значение

array

bool hasOption(string $name)

Определить, присутствует ли данный параметр.

Параметры

string $name

Возвращаемое значение

bool

string|array|bool|null option(string|null $key = null)

Получить значение параметра команды.

Параметры

string|null $key

Возвращаемое значение

string|array|bool|null

array options()

Получить все параметры, переданные команде.

Возвращаемое значение

array

bool confirm(string $question, bool $default = false)

Подтвердить вопрос у пользователя.

Параметры

string $question
bool $default

Возвращаемое значение

bool

mixed ask(string $question, string|null $default = null)

Запросить у пользователя ввод.

Параметры

string $question
string|null $default

Возвращаемое значение

mixed

mixed anticipate(string $question, array|callable $choices, string|null $default = null)

Запросить у пользователя ввод с автодополнением.

Параметры

string $question
array|callable $choices
string|null $default

Возвращаемое значение

mixed

mixed askWithCompletion(string $question, array|callable $choices, string|null $default = null)

Запросить у пользователя ввод с автодополнением.

Параметры

string $question
array|callable $choices
string|null $default

Возвращаемое значение

mixed

mixed secret(string $question, bool $fallback = true)

Запросить у пользователя ввод, но скрыть ответ от консоли.

Параметры

string $question
bool $fallback

Возвращаемое значение

mixed

string|array choice(string $question, array $choices, string|int|null $default = null, mixed|null $attempts = null, bool $multiple = false)

Предоставьте пользователю единственный выбор из массива ответов.

Parameters

string $question
array $choices
string|int|null $default
mixed|null $attempts
bool $multiple

Return Value

string|array

void table(array $headers, Arrayable|array $rows, TableStyle|string $tableStyle = 'default', array $columnStyles = [])

Форматирование ввода в текстовую таблицу.

Parameters

array $headers
Arrayable|array $rows
TableStyle|string $tableStyle
array $columnStyles

Return Value

void

mixed|void withProgressBar(iterable|int $totalSteps, Closure $callback)

Выполнение заданного обратного вызова с одновременным продвижением полосы прогресса.

Parameters

iterable|int $totalSteps
Closure $callback

Return Value

mixed|void

void info(string $string, int|string|null $verbosity = null)

Запись строки в качестве информационного вывода.

Parameters

string $string
int|string|null $verbosity

Return Value

void

void line(string $string, string|null $style = null, int|string|null $verbosity = null)

Запись строки в стандартный вывод.

Parameters

string $string
string|null $style
int|string|null $verbosity

Return Value

void

void comment(string $string, int|string|null $verbosity = null)

Запись строки в качестве комментария.

Parameters

string $string
int|string|null $verbosity

Return Value

void

void question(string $string, int|string|null $verbosity = null)

Запись строки в качестве вопроса.

Parameters

string $string
int|string|null $verbosity

Return Value

void

void error(string $string, int|string|null $verbosity = null)

Запись строки в качестве сообщения об ошибке.

Parameters

string $string
int|string|null $verbosity

Return Value

void

void warn(string $string, int|string|null $verbosity = null)

Запись строки в качестве предупреждения.

Parameters

string $string
int|string|null $verbosity

Return Value

void

void alert(string $string, int|string|null $verbosity = null)

Запись строки в информационное окно.

Parameters

string $string
int|string|null $verbosity

Return Value

void

$this newLine(int $count = 1)

Запись пустой строки.

Parameters

int $count

Return Value

$this

void setInput(InputInterface $input)

Установить реализацию интерфейса ввода.

Parameters

InputInterface $input

Return Value

void

void setOutput(OutputStyle $output)

Установить реализацию интерфейса вывода.

Parameters

OutputStyle $output

Return Value

void

protected void setVerbosity(string|int $level)

Установить уровень детализации.

Parameters

string|int $level

Return Value

void

protected int parseVerbosity(string|int|null $level = null)

Получение уровня детализации в терминах уровня OutputInterface Symfony.

Parameters

string|int|null $level

Return Value

int

OutputStyle getOutput()

Получение реализации вывода.

Return Value

OutputStyle

Factory outputComponents()

Получение реализации фабрики компонентов вывода.

Return Value

Factory

trap($signals, $callback)

Без описания

Parameters

$signals
$callback

void untrap()

internal

Отключение обработчиков сигналов, установленных в обработчике команды.

Return Value

void

protected void interact(InputInterface $input, OutputInterface $output)

Взаимодействовать с пользователем перед валидацией ввода.

Parameters

InputInterface $input
OutputInterface $output

Return Value

void

protected void promptForMissingArguments(InputInterface $input, OutputInterface $output)

Запросить у пользователя отсутствующие аргументы.

Parameters

InputInterface $input
OutputInterface $output

Return Value

void

protected array promptForMissingArgumentsUsing()

Запросить отсутствующие аргументы ввода, используя возвращаемые вопросы.

Return Value

array

protected void afterPromptingForMissingArguments(InputInterface $input, OutputInterface $output)

Выполнить действия после запроса отсутствующих аргументов у пользователя.

Parameters

InputInterface $input
OutputInterface $output

Return Value

void

protected bool didReceiveOptions(InputInterface $input)

Определяет, содержит ли входные данные какие-либо параметры, отличающиеся от значений по умолчанию.

Parameters

InputInterface $input

Return Value

bool

static void macro(string $name, object|callable $macro)

Зарегистрировать пользовательскую макрокоманду.

Parameters

string $name
object|callable $macro

Return Value

void

static void mixin(object $mixin, bool $replace = true)

Добавить другой объект в класс.

Parameters

object $mixin
bool $replace

Return Value

void

Exceptions

ReflectionException

static bool hasMacro(string $name)

Проверяет, зарегистрирована ли макрокоманда.

Parameters

string $name

Return Value

bool

static void flushMacros()

Очистить существующие макрокоманды.

Return Value

void

static mixed __callStatic(string $method, array $parameters)

Динамически обрабатывать вызовы класса.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

mixed __call(string $method, array $parameters)

Динамически обрабатывать вызовы класса.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

void __construct()

Создать новый экземпляр команды консоли.

Return Value

void

protected void configureUsingFluentDefinition()

Настроить команду консоли с помощью определения Fluent.

Return Value

void

protected void configureIsolation()

Настроить команду консоли для изоляции.

Return Value

void

int run(InputInterface $input, OutputInterface $output)

Выполнить команду консоли.

Parameters

InputInterface $input
OutputInterface $output

Return Value

int

protected int execute(InputInterface $input, OutputInterface $output)

Выполнить команду консоли.

Parameters

InputInterface $input
OutputInterface $output

Return Value

int

protected CommandMutex commandIsolationMutex()

Получить экземпляр блокировки изоляции команды для команды.

Return Value

CommandMutex

void fail(Throwable|string|null $exception = null)

Принудительно завершить команду с ошибкой.

Parameters

Throwable|string|null $exception

Return Value

void

Exceptions

Throwable

bool isHidden()

{@inheritdoc}

Return Value

bool

Command setHidden(bool $hidden = true)

{@inheritdoc}

Parameters

bool $hidden

Return Value

Command

Application getLaravel()

Получить экземпляр приложения Laravel.

Return Value

Application

void setLaravel(Container $laravel)

Установите экземпляр приложения Laravel.

Параметры

Container $laravel

Значение возврата

void

int handle()

Выполнить консольную команду.

Значение возврата

int

array getConnection()

Получить конфигурацию подключения к базе данных.

Значение возврата

array

Исключения

UnexpectedValueException

array commandArguments(array $connection)

Получить аргументы для команды клиента базы данных.

Параметры

array $connection

Значение возврата

array

array|null commandEnvironment(array $connection)

Получить переменные окружения для команды клиента базы данных.

Параметры

array $connection

Значение возврата

array|null

string getCommand(array $connection)

Получить команду клиента базы данных для выполнения.

Параметры

array $connection

Значение возврата

string

protected array getMysqlArguments(array $connection)

Получить аргументы для MySQL CLI.

Параметры

array $connection

Значение возврата

array

protected array getMariaDbArguments(array $connection)

Получить аргументы для MariaDB CLI.

Параметры

array $connection

Значение возврата

array

protected array getPgsqlArguments(array $connection)

Получить аргументы для Postgres CLI.

Параметры

array $connection

Значение возврата

array

protected array getSqliteArguments(array $connection)

Получить аргументы для SQLite CLI.

Параметры

array $connection

Значение возврата

array

protected array getSqlsrvArguments(array $connection)

Получить аргументы для SQL Server CLI.

Параметры

array $connection

Значение возврата

array

protected array|null getPgsqlEnvironment(array $connection)

Получить переменные окружения для Postgres CLI.

Параметры

array $connection

Значение возврата

array|null

protected array getOptionalArguments(array $args, array $connection)

Получить необязательные аргументы на основе конфигурации подключения.

Параметры

array $args
array $connection

Значение возврата

array

© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/11.x/Illuminate/Database/Console/DbCommand.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API