abstract class Command extends Command

Base command.

Traits

Controller helper trait.
Container aware trait.

Properties

protected Container $container Container.
protected array $resolved Array of resolved objects and/or references to resolved objects. from ContainerAwareTrait
Application $app from ContainerAwareTrait
CacheManager $cache from ContainerAwareTrait
Input $input from ContainerAwareTrait
Output $output from ContainerAwareTrait
CommandBusInterface $bus from ContainerAwareTrait
Config $config from ContainerAwareTrait
protected ConnectionManager $database Connection manager.
ErrorHandler $errorHandler from ContainerAwareTrait
Event $event from ContainerAwareTrait
protected FileSystem $fileSystem File system.
AuthorizerInterface $authorizer from ContainerAwareTrait
Gatekeeper $gatekeeper from ContainerAwareTrait
Request $request from ContainerAwareTrait
Response $response from ContainerAwareTrait
Routes $routes from ContainerAwareTrait
URLBuilder $urlBuilder from ContainerAwareTrait
I18n $i18n from ContainerAwareTrait
PaginationFactoryInterface $pagination from ContainerAwareTrait
ConnectionManager $redis from ContainerAwareTrait
CryptoManager $crypto from ContainerAwareTrait
Signer $signer from ContainerAwareTrait
Session $session from ContainerAwareTrait
Humanizer $humanizer from ContainerAwareTrait
ValidatorFactory $validator from ContainerAwareTrait
ViewFactory $view from ContainerAwareTrait
LoggerInterface $logger from ContainerAwareTrait
protected string $description Command description. from Command
protected array $commandInformation Command information. from Command
protected Application $application Application.

Methods

setContainer(Container $container)

Sets the container instance.

mixed
__get(string $key)

Resolves item from the container using overloading.

nl(int $lines = 1, int $writer = Output::STANDARD)

Writes n newlines to output.

write(string $string, int $writer = Output::STANDARD)

Writes string to output.

error(string $string)

Writes string to output using the error writer.

clear()

Clears the screen.

alert(string $message, string $template = Alert::DEFAULT, int $writer = Output::STANDARD)

Draws an alert.

bell(int $times = 1)

Rings the terminal bell n times.

countdown(int $from = 5)

Counts down from n.

progressBar(int $items, float $minTimeBetweenRedraw = 0.1, string|null $prefix = null)

Draws a progress bar and returns a progress bar instance.

table(array $columnNames, array $rows, int $writer = Output::STANDARD)

Draws a table.

ol(array $items, string $marker = '<yellow>%s</yellow>.', int $writer = Output::STANDARD)

Draws an ordered list.

ul(array $items, string $marker = '<yellow>*</yellow>', int $writer = Output::STANDARD)

Draws an unordered list.

bool
confirm(string $question, string $default = 'n')

Writes question to output and returns boolesn value corresponding to the chosen value.

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

Writes question to output and returns user input.

int
select(string $question, array $options)

Prints out a list of options and returns the array key of the chosen value.

mixed
secret(string $question, mixed $default = null, bool $fallback = false)

Writes question to output and returns hidden user input.

__construct(Input $input, Output $output, Application $application, FileSystem $fileSystem, ConnectionManager $database, Container $container)

Constructor.

string
getDescription()

Returns the command description.

from Command
array
getArguments()

Returns the command arguments.

from Command
string
getDefaultConnectionName()

Returns the default connection name of the application.

string
getConnectionName()

Returns the connection name for which we are running migrations.

builder()

Returns a query builder instance.

string
getBaseName(string $migration)

Returns the basename of the migration.

array
findApplicationMigrations()

Returns all application migrations.

array
findPackageMigrations()

Returns all package migrations.

array
findMigrations()

Finds all migrations.

string
getFullyQualifiedMigration(object $migration)

Returns the fully qualified class name of a migration.

array
getMigrationsFilteredByConnection()

Returns migrations filtered by connection name.

getMigrated(int|null $batches = null)

Returns migrations that have been run.

array
getOutstanding()

Returns an array of all outstanding migrations.

outputMigrationList(array $migrations)

Outputs a migration list.

resolve(object $migration)

Returns a migration instance.

buildMigrationWrapper(object $migration, Migration $migrationInstance, string $method, int|null $batch = null)

[buildMigrationWrapper description].

runMigration(object $migration, string $method, int|null $batch = null)

Executes a migration method.

Details

in ContainerAwareTrait at line 68
setContainer(Container $container)

Sets the container instance.

Parameters

Container $container Container

in ContainerAwareTrait at line 79
mixed __get(string $key)

Resolves item from the container using overloading.

Parameters

string $key Key

Return Value

mixed

in CommandHelperTrait at line 41
protected nl(int $lines = 1, int $writer = Output::STANDARD)

Writes n newlines to output.

Parameters

int $lines Number of newlines to write
int $writer Output writer

in CommandHelperTrait at line 52
protected write(string $string, int $writer = Output::STANDARD)

Writes string to output.

Parameters

string $string String to write
int $writer Output writer

in CommandHelperTrait at line 62
protected error(string $string)

Writes string to output using the error writer.

Parameters

string $string String to write

in CommandHelperTrait at line 70
protected clear()

Clears the screen.

in CommandHelperTrait at line 82
protected alert(string $message, string $template = Alert::DEFAULT, int $writer = Output::STANDARD)

Draws an alert.

Parameters

string $message Message
string $template Alert template
int $writer Output writer

in CommandHelperTrait at line 92
protected bell(int $times = 1)

Rings the terminal bell n times.

Parameters

int $times Number of times to ring the bell

in CommandHelperTrait at line 102
protected countdown(int $from = 5)

Counts down from n.

Parameters

int $from Number of seconds to count down

in CommandHelperTrait at line 115
protected ProgressBar progressBar(int $items, float $minTimeBetweenRedraw = 0.1, string|null $prefix = null)

Draws a progress bar and returns a progress bar instance.

Parameters

int $items Total number of items
float $minTimeBetweenRedraw Minimum time between redraw in seconds
string|null $prefix Progress bar prefix

Return Value

ProgressBar

in CommandHelperTrait at line 142
protected table(array $columnNames, array $rows, int $writer = Output::STANDARD)

Draws a table.

Parameters

array $columnNames Array of column names
array $rows Array of rows
int $writer Output writer

in CommandHelperTrait at line 154
protected ol(array $items, string $marker = '<yellow>%s</yellow>.', int $writer = Output::STANDARD)

Draws an ordered list.

Parameters

array $items Items
string $marker Item marker
int $writer Output writer

in CommandHelperTrait at line 166
protected ul(array $items, string $marker = '<yellow>*</yellow>', int $writer = Output::STANDARD)

Draws an unordered list.

Parameters

array $items Items
string $marker Item marker
int $writer Output writer

in CommandHelperTrait at line 178
protected bool confirm(string $question, string $default = 'n')

Writes question to output and returns boolesn value corresponding to the chosen value.

Parameters

string $question Question to ask
string $default Default answer

Return Value

bool

in CommandHelperTrait at line 190
protected mixed question(string $question, mixed $default = null)

Writes question to output and returns user input.

Parameters

string $question Question to ask
mixed $default Default if no input is entered

Return Value

mixed

in CommandHelperTrait at line 202
protected int select(string $question, array $options)

Prints out a list of options and returns the array key of the chosen value.

Parameters

string $question Question to ask
array $options Numeric array of options to choose from

Return Value

int

in CommandHelperTrait at line 215
protected mixed secret(string $question, mixed $default = null, bool $fallback = false)

Writes question to output and returns hidden user input.

Parameters

string $question Question to ask
mixed $default Default if no input is entered
bool $fallback Fall back to non-hidden input?

Return Value

mixed

at line 73
__construct(Input $input, Output $output, Application $application, FileSystem $fileSystem, ConnectionManager $database, Container $container)

Constructor.

Parameters

Input $input Input
Output $output Output
Application $application Application
FileSystem $fileSystem File system
ConnectionManager $database Connection manager
Container $container Container

in Command at line 74
string getDescription()

Returns the command description.

Return Value

string

in Command at line 82
array getArguments()

Returns the command arguments.

Return Value

array

at line 91
protected string getDefaultConnectionName()

Returns the default connection name of the application.

Return Value

string

at line 101
protected string getConnectionName()

Returns the connection name for which we are running migrations.

Return Value

string

at line 111
protected Query builder()

Returns a query builder instance.

Return Value

Query

at line 122
protected string getBaseName(string $migration)

Returns the basename of the migration.

Parameters

string $migration Task path

Return Value

string

at line 132
protected array findApplicationMigrations()

Returns all application migrations.

Return Value

array

at line 149
protected array findPackageMigrations()

Returns all package migrations.

Return Value

array

at line 169
protected array findMigrations()

Finds all migrations.

Return Value

array

at line 180
protected string getFullyQualifiedMigration(object $migration)

Returns the fully qualified class name of a migration.

Parameters

object $migration Migration

Return Value

string

at line 195
protected array getMigrationsFilteredByConnection()

Returns migrations filtered by connection name.

Return Value

array

at line 224
protected ResultSet getMigrated(int|null $batches = null)

Returns migrations that have been run.

Parameters

int|null $batches Number of batches fetch

Return Value

ResultSet

at line 241
protected array getOutstanding()

Returns an array of all outstanding migrations.

Return Value

array

at line 272
protected outputMigrationList(array $migrations)

Outputs a migration list.

Parameters

array $migrations Migrations

at line 299
protected Migration resolve(object $migration)

Returns a migration instance.

Parameters

object $migration Migration meta

Return Value

Migration

at line 313
protected Closure buildMigrationWrapper(object $migration, Migration $migrationInstance, string $method, int|null $batch = null)

[buildMigrationWrapper description].

Parameters

object $migration Migration meta
Migration $migrationInstance Migration instance
string $method Migration method
int|null $batch Migration batch

Return Value

Closure

at line 339
protected runMigration(object $migration, string $method, int|null $batch = null)

Executes a migration method.

Parameters

object $migration Migration meta
string $method Migration method
int|null $batch Batch