MigrationCreator
class MigrationCreator
Constants
| protected CURRENT_MIGRATION_PATH_CONTEXT_KEY_PREFIX |
|
Properties
| protected array<Closure(?string, string): void> | $postCreate | The registered post create hooks. |
Methods
Create a new migration creator instance.
Create a new migration at the given path.
Ensure that a migration with the given name doesn't already exist.
Get the migration stub file.
Populate the place-holders in the migration stub.
Get the class name of a migration name.
Get the full path to the migration.
Get a collision-free full path to the migration.
Fire the registered post create hooks.
Get the date prefix for the migration.
Get files matching the given pattern.
Get the path to the stubs.
Get the filesystem instance.
Details
at line 31
__construct(Filesystem $files, string|null $customStubPath = null)
Create a new migration creator instance.
at line 42
string
create(string $name, string $path, string|null $table = null, bool $create = false, string|null $stubPath = null)
Create a new migration at the given path.
at line 75
protected void
ensureMigrationDoesntAlreadyExist(string $name, string|null $migrationPath = null)
Ensure that a migration with the given name doesn't already exist.
at line 93
protected string
getStub(string|null $table, bool $create)
Get the migration stub file.
at line 115
protected string
populateStub(string $stub, string|null $table)
Populate the place-holders in the migration stub.
at line 134
protected string
getClassName(string $name)
Get the class name of a migration name.
at line 142
protected string
getPath(string $name, string $path)
Get the full path to the migration.
at line 150
protected string
getCollisionFreePath(string $name, string $path)
Get a collision-free full path to the migration.
at line 166
protected void
firePostCreateHooks(string|null $table, string $path)
Fire the registered post create hooks.
at line 181
void
afterCreate(Closure $callback)
Register a post migration create hook.
Hooks persist on the shared migration creator for the worker lifetime and run for every subsequent migration creation.
at line 190
protected string
getDatePrefix()
Get the date prefix for the migration.
at line 214
protected array
matchingFiles(string $pattern)
Get files matching the given pattern.
at line 228
string
stubPath()
Get the path to the stubs.
at line 236
Filesystem
getFilesystem()
Get the filesystem instance.