class Down extends Command

Command that rolls back the last batch of migrations.

Traits

Rollback trait.
Controller helper trait.
Container aware trait.

Properties

protected Container $container Container. from ContainerAwareTrait
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
ConnectionManager $database from ContainerAwareTrait
ErrorHandler $errorHandler from ContainerAwareTrait
Event $event from ContainerAwareTrait
FileSystem $fileSystem from ContainerAwareTrait
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 array $commandInformation Command information.
protected bool $isStrict Make the command strict. from Command
protected Application $application Application. from Command

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, int|null $redrawRate = null, 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.

from Command
string
getCommandDescription()

Returns the command description.

from Command
array
getCommandArguments()

Returns the command arguments.

from Command
array
getCommandOptions()

Returns the command options.

from Command
bool
isStrict()

Returns TRUE we should be strict about what arguments and options we allow and FALSE if not.

from Command
string
getDefaultConnectionName()

Returns the default connection name of the application.

from Command
string
getConnectionName()

Returns the connection name for which we are running migrations.

from Command
builder()

Returns a query builder instance.

from Command
string
getBaseName(string $migration)

Returns the basename of the migration.

from Command
array
findApplicationMigrations()

Returns all application migrations.

from Command
array
findPackageMigrations()

Returns all package migrations.

from Command
array
findMigrations()

Finds all migrations.

from Command
string
getFullyQualifiedMigration(object $migration)

Returns the fully qualified class name of a migration.

from Command
array
getMigrationsFilteredByConnection()

Returns migrations filtered by connection name.

from Command
getMigrated(int|null $batches = null)

Returns migrations that have been run.

from Command
array
getOutstanding()

Returns an array of all outstanding migrations.

from Command
outputMigrationList(array $migrations)

Outputs a migration list.

from Command
resolve(object $migration)

Returns a migration instance.

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

[buildMigrationWrapper description].

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

Executes a migration method.

from Command
rollback(int|null $batches = null)

Rolls back n batches.

execute(int $batches = 1)

Executes the command.

Details

in ContainerAwareTrait at line 68
setContainer(Container $container)

Sets the container instance.

Parameters

Container $container Container

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

Resolves item from the container using overloading.

Parameters

string $key Key

Return Value

mixed

Exceptions

RuntimeException

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, int|null $redrawRate = null, string|null $prefix = null)

Draws a progress bar and returns a progress bar instance.

Parameters

int $items Total number of items
int|null $redrawRate Redraw rate
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

in Command at line 80
__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 72
string getCommandDescription()

Returns the command description.

Return Value

string

in Command at line 80
array getCommandArguments()

Returns the command arguments.

Return Value

array

in Command at line 88
array getCommandOptions()

Returns the command options.

Return Value

array

in Command at line 96
bool isStrict()

Returns TRUE we should be strict about what arguments and options we allow and FALSE if not.

Return Value

bool

in Command at line 98
protected string getDefaultConnectionName()

Returns the default connection name of the application.

Return Value

string

in Command at line 108
protected string getConnectionName()

Returns the connection name for which we are running migrations.

Return Value

string

in Command at line 118
protected Query builder()

Returns a query builder instance.

Return Value

Query

in Command at line 129
protected string getBaseName(string $migration)

Returns the basename of the migration.

Parameters

string $migration Task path

Return Value

string

in Command at line 139
protected array findApplicationMigrations()

Returns all application migrations.

Return Value

array

in Command at line 156
protected array findPackageMigrations()

Returns all package migrations.

Return Value

array

in Command at line 176
protected array findMigrations()

Finds all migrations.

Return Value

array

in Command at line 187
protected string getFullyQualifiedMigration(object $migration)

Returns the fully qualified class name of a migration.

Parameters

object $migration Migration

Return Value

string

in Command at line 202
protected array getMigrationsFilteredByConnection()

Returns migrations filtered by connection name.

Return Value

array

in Command at line 231
protected ResultSet getMigrated(int|null $batches = null)

Returns migrations that have been run.

Parameters

int|null $batches Number of batches fetch

Return Value

ResultSet

in Command at line 248
protected array getOutstanding()

Returns an array of all outstanding migrations.

Return Value

array

in Command at line 279
protected outputMigrationList(array $migrations)

Outputs a migration list.

Parameters

array $migrations Migrations

in Command at line 306
protected Migration resolve(object $migration)

Returns a migration instance.

Parameters

object $migration Migration meta

Return Value

Migration

in Command at line 320
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

in Command at line 346
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

in RollbackTrait at line 22
rollback(int|null $batches = null)

Rolls back n batches.

Parameters

int|null $batches Number of batches to roll back

at line 49
execute(int $batches = 1)

Executes the command.

Parameters

int $batches Number of batches to roll back