MigrationCreator

class MigrationCreator (View source)

Properties

protected Filesystem $files The filesystem instance.
protected array $postCreate The registered post create hooks.

Methods

void __construct(Filesystem $files)

Create a new migration creator instance.

string create(string $name, string $path, string $table = null, bool $create = false)

Create a new migration at the given path.

void ensureMigrationDoesntAlreadyExist(string $name)

Ensure that a migration with the given name doesn't already exist.

string getStub(string $table, bool $create)

Get the migration stub file.

string populateStub(string $name, string $stub, string $table)

Populate the place-holders in the migration stub.

string getClassName(string $name)

Get the class name of a migration name.

string getPath(string $name, string $path)

Get the full path to the migration.

void firePostCreateHooks(string $table)

Fire the registered post create hooks.

void afterCreate(Closure $callback)

Register a post migration create hook.

string getDatePrefix()

Get the date prefix for the migration.

string stubPath()

Get the path to the stubs.

Filesystem getFilesystem()

Get the filesystem instance.

Details

void __construct(Filesystem $files)

Create a new migration creator instance.

Parameters

Filesystem $files

Return Value

void

string create(string $name, string $path, string $table = null, bool $create = false)

Create a new migration at the given path.

Parameters

string $name
string $path
string $table
bool $create

Return Value

string

Exceptions

Exception

protected void ensureMigrationDoesntAlreadyExist(string $name)

Ensure that a migration with the given name doesn't already exist.

Parameters

string $name

Return Value

void

Exceptions

InvalidArgumentException

protected string getStub(string $table, bool $create)

Get the migration stub file.

Parameters

string $table
bool $create

Return Value

string

protected string populateStub(string $name, string $stub, string $table)

Populate the place-holders in the migration stub.

Parameters

string $name
string $stub
string $table

Return Value

string

protected string getClassName(string $name)

Get the class name of a migration name.

Parameters

string $name

Return Value

string

protected string getPath(string $name, string $path)

Get the full path to the migration.

Parameters

string $name
string $path

Return Value

string

protected void firePostCreateHooks(string $table)

Fire the registered post create hooks.

Parameters

string $table

Return Value

void

void afterCreate(Closure $callback)

Register a post migration create hook.

Parameters

Closure $callback

Return Value

void

protected string getDatePrefix()

Get the date prefix for the migration.

Return Value

string

string stubPath()

Get the path to the stubs.

Return Value

string

Filesystem getFilesystem()

Get the filesystem instance.

Return Value

Filesystem

© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/5.7/Illuminate/Database/Migrations/MigrationCreator.html