W3cubDocs

/Laravel 5.8

Blueprint

class Blueprint (View source)

Traits

Macroable

Properties

static protected array $macros The registered string macros. from Macroable
protected string $table The table the blueprint describes.
protected string $prefix The prefix of the table.
protected ColumnDefinition[] $columns The columns that should be added to the table.
protected Fluent[] $commands The commands that should be run for the table.
string $engine The storage engine that should be used for the table.
$charset The default character set that should be used for the table.
$collation The collation that should be used for the table.
bool $temporary Whether to make the table temporary.

Methods

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

Register a custom macro.

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

Mix another object into the class.

from Macroable
static bool hasMacro(string $name)

Checks if macro is registered.

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

Dynamically handle calls to the class.

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

Dynamically handle calls to the class.

from Macroable
void __construct(string $table, Closure $callback = null, string $prefix = '')

Create a new schema blueprint.

void build(Connection $connection, Grammar $grammar)

Execute the blueprint against the database.

array toSql(Connection $connection, Grammar $grammar)

Get the raw SQL statements for the blueprint.

void ensureCommandsAreValid(Connection $connection)

Ensure the commands on the blueprint are valid for the connection type.

Collection commandsNamed(array $names)

Get all of the commands matching the given names.

void addImpliedCommands(Grammar $grammar)

Add the commands that are implied by the blueprint's state.

void addFluentIndexes()

Add the index commands fluently specified on columns.

void addFluentCommands(Grammar $grammar)

Add the fluent commands specified on any columns.

bool creating()

Determine if the blueprint has a create command.

Fluent create()

Indicate that the table needs to be created.

void temporary()

Indicate that the table needs to be temporary.

Fluent drop()

Indicate that the table should be dropped.

Fluent dropIfExists()

Indicate that the table should be dropped if it exists.

Fluent dropColumn(array|mixed $columns)

Indicate that the given columns should be dropped.

Fluent renameColumn(string $from, string $to)

Indicate that the given columns should be renamed.

Fluent dropPrimary(string|array|null $index = null)

Indicate that the given primary key should be dropped.

Fluent dropUnique(string|array $index)

Indicate that the given unique key should be dropped.

Fluent dropIndex(string|array $index)

Indicate that the given index should be dropped.

Fluent dropSpatialIndex(string|array $index)

Indicate that the given spatial index should be dropped.

Fluent dropForeign(string|array $index)

Indicate that the given foreign key should be dropped.

Fluent renameIndex(string $from, string $to)

Indicate that the given indexes should be renamed.

void dropTimestamps()

Indicate that the timestamp columns should be dropped.

void dropTimestampsTz()

Indicate that the timestamp columns should be dropped.

void dropSoftDeletes(string $column = 'deleted_at')

Indicate that the soft delete column should be dropped.

void dropSoftDeletesTz(string $column = 'deleted_at')

Indicate that the soft delete column should be dropped.

void dropRememberToken()

Indicate that the remember token column should be dropped.

void dropMorphs(string $name, string|null $indexName = null)

Indicate that the polymorphic columns should be dropped.

Fluent rename(string $to)

Rename the table to a given name.

Fluent primary(string|array $columns, string|null $name = null, string|null $algorithm = null)

Specify the primary key(s) for the table.

Fluent unique(string|array $columns, string|null $name = null, string|null $algorithm = null)

Specify a unique index for the table.

Fluent index(string|array $columns, string|null $name = null, string|null $algorithm = null)

Specify an index for the table.

Fluent spatialIndex(string|array $columns, string|null $name = null)

Specify a spatial index for the table.

Fluent|ForeignKeyDefinition foreign(string|array $columns, string|null $name = null)

Specify a foreign key for the table.

ColumnDefinition increments(string $column)

Create a new auto-incrementing integer (4-byte) column on the table.

ColumnDefinition integerIncrements(string $column)

Create a new auto-incrementing integer (4-byte) column on the table.

ColumnDefinition tinyIncrements(string $column)

Create a new auto-incrementing tiny integer (1-byte) column on the table.

ColumnDefinition smallIncrements(string $column)

Create a new auto-incrementing small integer (2-byte) column on the table.

ColumnDefinition mediumIncrements(string $column)

Create a new auto-incrementing medium integer (3-byte) column on the table.

ColumnDefinition bigIncrements(string $column)

Create a new auto-incrementing big integer (8-byte) column on the table.

ColumnDefinition char(string $column, int|null $length = null)

Create a new char column on the table.

ColumnDefinition string(string $column, int|null $length = null)

Create a new string column on the table.

ColumnDefinition text(string $column)

Create a new text column on the table.

ColumnDefinition mediumText(string $column)

Create a new medium text column on the table.

ColumnDefinition longText(string $column)

Create a new long text column on the table.

ColumnDefinition integer(string $column, bool $autoIncrement = false, bool $unsigned = false)

Create a new integer (4-byte) column on the table.

ColumnDefinition tinyInteger(string $column, bool $autoIncrement = false, bool $unsigned = false)

Create a new tiny integer (1-byte) column on the table.

ColumnDefinition smallInteger(string $column, bool $autoIncrement = false, bool $unsigned = false)

Create a new small integer (2-byte) column on the table.

ColumnDefinition mediumInteger(string $column, bool $autoIncrement = false, bool $unsigned = false)

Create a new medium integer (3-byte) column on the table.

ColumnDefinition bigInteger(string $column, bool $autoIncrement = false, bool $unsigned = false)

Create a new big integer (8-byte) column on the table.

ColumnDefinition unsignedInteger(string $column, bool $autoIncrement = false)

Create a new unsigned integer (4-byte) column on the table.

ColumnDefinition unsignedTinyInteger(string $column, bool $autoIncrement = false)

Create a new unsigned tiny integer (1-byte) column on the table.

ColumnDefinition unsignedSmallInteger(string $column, bool $autoIncrement = false)

Create a new unsigned small integer (2-byte) column on the table.

ColumnDefinition unsignedMediumInteger(string $column, bool $autoIncrement = false)

Create a new unsigned medium integer (3-byte) column on the table.

ColumnDefinition unsignedBigInteger(string $column, bool $autoIncrement = false)

Create a new unsigned big integer (8-byte) column on the table.

ColumnDefinition float(string $column, int $total = 8, int $places = 2)

Create a new float column on the table.

ColumnDefinition double(string $column, int|null $total = null, int|null $places = null)

Create a new double column on the table.

ColumnDefinition decimal(string $column, int $total = 8, int $places = 2)

Create a new decimal column on the table.

ColumnDefinition unsignedDecimal(string $column, int $total = 8, int $places = 2)

Create a new unsigned decimal column on the table.

ColumnDefinition boolean(string $column)

Create a new boolean column on the table.

ColumnDefinition enum(string $column, array $allowed)

Create a new enum column on the table.

ColumnDefinition set(string $column, array $allowed)

Create a new set column on the table.

ColumnDefinition json(string $column)

Create a new json column on the table.

ColumnDefinition jsonb(string $column)

Create a new jsonb column on the table.

ColumnDefinition date(string $column)

Create a new date column on the table.

ColumnDefinition dateTime(string $column, int $precision = 0)

Create a new date-time column on the table.

ColumnDefinition dateTimeTz(string $column, int $precision = 0)

Create a new date-time column (with time zone) on the table.

ColumnDefinition time(string $column, int $precision = 0)

Create a new time column on the table.

ColumnDefinition timeTz(string $column, int $precision = 0)

Create a new time column (with time zone) on the table.

ColumnDefinition timestamp(string $column, int $precision = 0)

Create a new timestamp column on the table.

ColumnDefinition timestampTz(string $column, int $precision = 0)

Create a new timestamp (with time zone) column on the table.

void timestamps(int $precision = 0)

Add nullable creation and update timestamps to the table.

void nullableTimestamps(int $precision = 0)

Add nullable creation and update timestamps to the table.

void timestampsTz(int $precision = 0)

Add creation and update timestampTz columns to the table.

ColumnDefinition softDeletes(string $column = 'deleted_at', int $precision = 0)

Add a "deleted at" timestamp for the table.

ColumnDefinition softDeletesTz(string $column = 'deleted_at', int $precision = 0)

Add a "deleted at" timestampTz for the table.

ColumnDefinition year(string $column)

Create a new year column on the table.

ColumnDefinition binary(string $column)

Create a new binary column on the table.

ColumnDefinition uuid(string $column)

Create a new uuid column on the table.

ColumnDefinition ipAddress(string $column)

Create a new IP address column on the table.

ColumnDefinition macAddress(string $column)

Create a new MAC address column on the table.

ColumnDefinition geometry(string $column)

Create a new geometry column on the table.

ColumnDefinition point(string $column, int|null $srid = null)

Create a new point column on the table.

ColumnDefinition lineString(string $column)

Create a new linestring column on the table.

ColumnDefinition polygon(string $column)

Create a new polygon column on the table.

ColumnDefinition geometryCollection(string $column)

Create a new geometrycollection column on the table.

ColumnDefinition multiPoint(string $column)

Create a new multipoint column on the table.

ColumnDefinition multiLineString(string $column)

Create a new multilinestring column on the table.

ColumnDefinition multiPolygon(string $column)

Create a new multipolygon column on the table.

ColumnDefinition multiPolygonZ(string $column)

Create a new multipolygon column on the table.

ColumnDefinition computed(string $column, string $expression)

Create a new generated, computed column on the table.

void morphs(string $name, string|null $indexName = null)

Add the proper columns for a polymorphic table.

void nullableMorphs(string $name, string|null $indexName = null)

Add nullable columns for a polymorphic table.

void uuidMorphs(string $name, string|null $indexName = null)

Add the proper columns for a polymorphic table using UUIDs.

void nullableUuidMorphs(string $name, string|null $indexName = null)

Add nullable columns for a polymorphic table using UUIDs.

ColumnDefinition rememberToken()

Adds the remember_token column to the table.

Fluent indexCommand(string $type, string|array $columns, string $index, string|null $algorithm = null)

Add a new index command to the blueprint.

Fluent dropIndexCommand(string $command, string $type, string|array $index)

Create a new drop index command on the blueprint.

string createIndexName(string $type, array $columns)

Create a default index name for the table.

ColumnDefinition addColumn(string $type, string $name, array $parameters = [])

Add a new column to the blueprint.

$this removeColumn(string $name)

Remove a column from the schema blueprint.

Fluent addCommand(string $name, array $parameters = [])

Add a new command to the blueprint.

Fluent createCommand(string $name, array $parameters = [])

Create a new Fluent command.

string getTable()

Get the table the blueprint describes.

ColumnDefinition[] getColumns()

Get the columns on the blueprint.

Fluent[] getCommands()

Get the commands on the blueprint.

ColumnDefinition[] getAddedColumns()

Get the columns on the blueprint that should be added.

ColumnDefinition[] getChangedColumns()

Get the columns on the blueprint that should be changed.

Details

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

Register a custom macro.

Parameters

string $name
object|callable $macro

Return Value

void

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

Mix another object into the class.

Parameters

object $mixin
bool $replace

Return Value

void

Exceptions

ReflectionException

static bool hasMacro(string $name)

Checks if macro is registered.

Parameters

string $name

Return Value

bool

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

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

mixed __call(string $method, array $parameters)

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

void __construct(string $table, Closure $callback = null, string $prefix = '')

Create a new schema blueprint.

Parameters

string $table
Closure $callback
string $prefix

Return Value

void

void build(Connection $connection, Grammar $grammar)

Execute the blueprint against the database.

Parameters

Connection $connection
Grammar $grammar

Return Value

void

array toSql(Connection $connection, Grammar $grammar)

Get the raw SQL statements for the blueprint.

Parameters

Connection $connection
Grammar $grammar

Return Value

array

protected void ensureCommandsAreValid(Connection $connection)

Ensure the commands on the blueprint are valid for the connection type.

Parameters

Connection $connection

Return Value

void

Exceptions

BadMethodCallException

protected Collection commandsNamed(array $names)

Get all of the commands matching the given names.

Parameters

array $names

Return Value

Collection

protected void addImpliedCommands(Grammar $grammar)

Add the commands that are implied by the blueprint's state.

Parameters

Grammar $grammar

Return Value

void

protected void addFluentIndexes()

Add the index commands fluently specified on columns.

Return Value

void

void addFluentCommands(Grammar $grammar)

Add the fluent commands specified on any columns.

Parameters

Grammar $grammar

Return Value

void

protected bool creating()

Determine if the blueprint has a create command.

Return Value

bool

Fluent create()

Indicate that the table needs to be created.

Return Value

Fluent

void temporary()

Indicate that the table needs to be temporary.

Return Value

void

Fluent drop()

Indicate that the table should be dropped.

Return Value

Fluent

Fluent dropIfExists()

Indicate that the table should be dropped if it exists.

Return Value

Fluent

Fluent dropColumn(array|mixed $columns)

Indicate that the given columns should be dropped.

Parameters

array|mixed $columns

Return Value

Fluent

Fluent renameColumn(string $from, string $to)

Indicate that the given columns should be renamed.

Parameters

string $from
string $to

Return Value

Fluent

Fluent dropPrimary(string|array|null $index = null)

Indicate that the given primary key should be dropped.

Parameters

string|array|null $index

Return Value

Fluent

Fluent dropUnique(string|array $index)

Indicate that the given unique key should be dropped.

Parameters

string|array $index

Return Value

Fluent

Fluent dropIndex(string|array $index)

Indicate that the given index should be dropped.

Parameters

string|array $index

Return Value

Fluent

Fluent dropSpatialIndex(string|array $index)

Indicate that the given spatial index should be dropped.

Parameters

string|array $index

Return Value

Fluent

Fluent dropForeign(string|array $index)

Indicate that the given foreign key should be dropped.

Parameters

string|array $index

Return Value

Fluent

Fluent renameIndex(string $from, string $to)

Indicate that the given indexes should be renamed.

Parameters

string $from
string $to

Return Value

Fluent

void dropTimestamps()

Indicate that the timestamp columns should be dropped.

Return Value

void

void dropTimestampsTz()

Indicate that the timestamp columns should be dropped.

Return Value

void

void dropSoftDeletes(string $column = 'deleted_at')

Indicate that the soft delete column should be dropped.

Parameters

string $column

Return Value

void

void dropSoftDeletesTz(string $column = 'deleted_at')

Indicate that the soft delete column should be dropped.

Parameters

string $column

Return Value

void

void dropRememberToken()

Indicate that the remember token column should be dropped.

Return Value

void

void dropMorphs(string $name, string|null $indexName = null)

Indicate that the polymorphic columns should be dropped.

Parameters

string $name
string|null $indexName

Return Value

void

Fluent rename(string $to)

Rename the table to a given name.

Parameters

string $to

Return Value

Fluent

Fluent primary(string|array $columns, string|null $name = null, string|null $algorithm = null)

Specify the primary key(s) for the table.

Parameters

string|array $columns
string|null $name
string|null $algorithm

Return Value

Fluent

Fluent unique(string|array $columns, string|null $name = null, string|null $algorithm = null)

Specify a unique index for the table.

Parameters

string|array $columns
string|null $name
string|null $algorithm

Return Value

Fluent

Fluent index(string|array $columns, string|null $name = null, string|null $algorithm = null)

Specify an index for the table.

Parameters

string|array $columns
string|null $name
string|null $algorithm

Return Value

Fluent

Fluent spatialIndex(string|array $columns, string|null $name = null)

Specify a spatial index for the table.

Parameters

string|array $columns
string|null $name

Return Value

Fluent

Fluent|ForeignKeyDefinition foreign(string|array $columns, string|null $name = null)

Specify a foreign key for the table.

Parameters

string|array $columns
string|null $name

Return Value

Fluent|ForeignKeyDefinition

ColumnDefinition increments(string $column)

Create a new auto-incrementing integer (4-byte) column on the table.

Parameters

string $column

Return Value

ColumnDefinition

ColumnDefinition integerIncrements(string $column)

Create a new auto-incrementing integer (4-byte) column on the table.

Parameters

string $column

Return Value

ColumnDefinition

ColumnDefinition tinyIncrements(string $column)

Create a new auto-incrementing tiny integer (1-byte) column on the table.

Parameters

string $column

Return Value

ColumnDefinition

ColumnDefinition smallIncrements(string $column)

Create a new auto-incrementing small integer (2-byte) column on the table.

Parameters

string $column

Return Value

ColumnDefinition

ColumnDefinition mediumIncrements(string $column)

Create a new auto-incrementing medium integer (3-byte) column on the table.

Parameters

string $column

Return Value

ColumnDefinition

ColumnDefinition bigIncrements(string $column)

Create a new auto-incrementing big integer (8-byte) column on the table.

Parameters

string $column

Return Value

ColumnDefinition

ColumnDefinition char(string $column, int|null $length = null)

Create a new char column on the table.

Parameters

string $column
int|null $length

Return Value

ColumnDefinition

ColumnDefinition string(string $column, int|null $length = null)

Create a new string column on the table.

Parameters

string $column
int|null $length

Return Value

ColumnDefinition

ColumnDefinition text(string $column)

Create a new text column on the table.

Parameters

string $column

Return Value

ColumnDefinition

ColumnDefinition mediumText(string $column)

Create a new medium text column on the table.

Parameters

string $column

Return Value

ColumnDefinition

ColumnDefinition longText(string $column)

Create a new long text column on the table.

Parameters

string $column

Return Value

ColumnDefinition

ColumnDefinition integer(string $column, bool $autoIncrement = false, bool $unsigned = false)

Create a new integer (4-byte) column on the table.

Parameters

string $column
bool $autoIncrement
bool $unsigned

Return Value

ColumnDefinition

ColumnDefinition tinyInteger(string $column, bool $autoIncrement = false, bool $unsigned = false)

Create a new tiny integer (1-byte) column on the table.

Parameters

string $column
bool $autoIncrement
bool $unsigned

Return Value

ColumnDefinition

ColumnDefinition smallInteger(string $column, bool $autoIncrement = false, bool $unsigned = false)

Create a new small integer (2-byte) column on the table.

Parameters

string $column
bool $autoIncrement
bool $unsigned

Return Value

ColumnDefinition

ColumnDefinition mediumInteger(string $column, bool $autoIncrement = false, bool $unsigned = false)

Create a new medium integer (3-byte) column on the table.

Parameters

string $column
bool $autoIncrement
bool $unsigned

Return Value

ColumnDefinition

ColumnDefinition bigInteger(string $column, bool $autoIncrement = false, bool $unsigned = false)

Create a new big integer (8-byte) column on the table.

Parameters

string $column
bool $autoIncrement
bool $unsigned

Return Value

ColumnDefinition

ColumnDefinition unsignedInteger(string $column, bool $autoIncrement = false)

Create a new unsigned integer (4-byte) column on the table.

Parameters

string $column
bool $autoIncrement

Return Value

ColumnDefinition

ColumnDefinition unsignedTinyInteger(string $column, bool $autoIncrement = false)

Create a new unsigned tiny integer (1-byte) column on the table.

Parameters

string $column
bool $autoIncrement

Return Value

ColumnDefinition

ColumnDefinition unsignedSmallInteger(string $column, bool $autoIncrement = false)

Create a new unsigned small integer (2-byte) column on the table.

Parameters

string $column
bool $autoIncrement

Return Value

ColumnDefinition

ColumnDefinition unsignedMediumInteger(string $column, bool $autoIncrement = false)

Create a new unsigned medium integer (3-byte) column on the table.

Parameters

string $column
bool $autoIncrement

Return Value

ColumnDefinition

ColumnDefinition unsignedBigInteger(string $column, bool $autoIncrement = false)

Create a new unsigned big integer (8-byte) column on the table.

Parameters

string $column
bool $autoIncrement

Return Value

ColumnDefinition

ColumnDefinition float(string $column, int $total = 8, int $places = 2)

Create a new float column on the table.

Parameters

string $column
int $total
int $places

Return Value

ColumnDefinition

ColumnDefinition double(string $column, int|null $total = null, int|null $places = null)

Create a new double column on the table.

Parameters

string $column
int|null $total
int|null $places

Return Value

ColumnDefinition

ColumnDefinition decimal(string $column, int $total = 8, int $places = 2)

Create a new decimal column on the table.

Parameters

string $column
int $total
int $places

Return Value

ColumnDefinition

ColumnDefinition unsignedDecimal(string $column, int $total = 8, int $places = 2)

Create a new unsigned decimal column on the table.

Parameters

string $column
int $total
int $places

Return Value

ColumnDefinition

ColumnDefinition boolean(string $column)

Create a new boolean column on the table.

Parameters

string $column

Return Value

ColumnDefinition

ColumnDefinition enum(string $column, array $allowed)

Create a new enum column on the table.

Parameters

string $column
array $allowed

Return Value

ColumnDefinition

ColumnDefinition set(string $column, array $allowed)

Create a new set column on the table.

Parameters

string $column
array $allowed

Return Value

ColumnDefinition

ColumnDefinition json(string $column)

Create a new json column on the table.

Parameters

string $column

Return Value

ColumnDefinition

ColumnDefinition jsonb(string $column)

Create a new jsonb column on the table.

Parameters

string $column

Return Value

ColumnDefinition

ColumnDefinition date(string $column)

Create a new date column on the table.

Parameters

string $column

Return Value

ColumnDefinition

ColumnDefinition dateTime(string $column, int $precision = 0)

Create a new date-time column on the table.

Parameters

string $column
int $precision

Return Value

ColumnDefinition

ColumnDefinition dateTimeTz(string $column, int $precision = 0)

Create a new date-time column (with time zone) on the table.

Parameters

string $column
int $precision

Return Value

ColumnDefinition

ColumnDefinition time(string $column, int $precision = 0)

Create a new time column on the table.

Parameters

string $column
int $precision

Return Value

ColumnDefinition

ColumnDefinition timeTz(string $column, int $precision = 0)

Create a new time column (with time zone) on the table.

Parameters

string $column
int $precision

Return Value

ColumnDefinition

ColumnDefinition timestamp(string $column, int $precision = 0)

Create a new timestamp column on the table.

Parameters

string $column
int $precision

Return Value

ColumnDefinition

ColumnDefinition timestampTz(string $column, int $precision = 0)

Create a new timestamp (with time zone) column on the table.

Parameters

string $column
int $precision

Return Value

ColumnDefinition

void timestamps(int $precision = 0)

Add nullable creation and update timestamps to the table.

Parameters

int $precision

Return Value

void

void nullableTimestamps(int $precision = 0)

Add nullable creation and update timestamps to the table.

Alias for self::timestamps().

Parameters

int $precision

Return Value

void

void timestampsTz(int $precision = 0)

Add creation and update timestampTz columns to the table.

Parameters

int $precision

Return Value

void

ColumnDefinition softDeletes(string $column = 'deleted_at', int $precision = 0)

Add a "deleted at" timestamp for the table.

Parameters

string $column
int $precision

Return Value

ColumnDefinition

ColumnDefinition softDeletesTz(string $column = 'deleted_at', int $precision = 0)

Add a "deleted at" timestampTz for the table.

Parameters

string $column
int $precision

Return Value

ColumnDefinition

ColumnDefinition year(string $column)

Create a new year column on the table.

Parameters

string $column

Return Value

ColumnDefinition

ColumnDefinition binary(string $column)

Create a new binary column on the table.

Parameters

string $column

Return Value

ColumnDefinition

ColumnDefinition uuid(string $column)

Create a new uuid column on the table.

Parameters

string $column

Return Value

ColumnDefinition

ColumnDefinition ipAddress(string $column)

Create a new IP address column on the table.

Parameters

string $column

Return Value

ColumnDefinition

ColumnDefinition macAddress(string $column)

Create a new MAC address column on the table.

Parameters

string $column

Return Value

ColumnDefinition

ColumnDefinition geometry(string $column)

Create a new geometry column on the table.

Parameters

string $column

Return Value

ColumnDefinition

ColumnDefinition point(string $column, int|null $srid = null)

Create a new point column on the table.

Parameters

string $column
int|null $srid

Return Value

ColumnDefinition

ColumnDefinition lineString(string $column)

Create a new linestring column on the table.

Parameters

string $column

Return Value

ColumnDefinition

ColumnDefinition polygon(string $column)

Create a new polygon column on the table.

Parameters

string $column

Return Value

ColumnDefinition

ColumnDefinition geometryCollection(string $column)

Create a new geometrycollection column on the table.

Parameters

string $column

Return Value

ColumnDefinition

ColumnDefinition multiPoint(string $column)

Create a new multipoint column on the table.

Parameters

string $column

Return Value

ColumnDefinition

ColumnDefinition multiLineString(string $column)

Create a new multilinestring column on the table.

Parameters

string $column

Return Value

ColumnDefinition

ColumnDefinition multiPolygon(string $column)

Create a new multipolygon column on the table.

Parameters

string $column

Return Value

ColumnDefinition

ColumnDefinition multiPolygonZ(string $column)

Create a new multipolygon column on the table.

Parameters

string $column

Return Value

ColumnDefinition

ColumnDefinition computed(string $column, string $expression)

Create a new generated, computed column on the table.

Parameters

string $column
string $expression

Return Value

ColumnDefinition

void morphs(string $name, string|null $indexName = null)

Add the proper columns for a polymorphic table.

Parameters

string $name
string|null $indexName

Return Value

void

void nullableMorphs(string $name, string|null $indexName = null)

Add nullable columns for a polymorphic table.

Parameters

string $name
string|null $indexName

Return Value

void

void uuidMorphs(string $name, string|null $indexName = null)

Add the proper columns for a polymorphic table using UUIDs.

Parameters

string $name
string|null $indexName

Return Value

void

void nullableUuidMorphs(string $name, string|null $indexName = null)

Add nullable columns for a polymorphic table using UUIDs.

Parameters

string $name
string|null $indexName

Return Value

void

ColumnDefinition rememberToken()

Adds the remember_token column to the table.

Return Value

ColumnDefinition

protected Fluent indexCommand(string $type, string|array $columns, string $index, string|null $algorithm = null)

Add a new index command to the blueprint.

Parameters

string $type
string|array $columns
string $index
string|null $algorithm

Return Value

Fluent

protected Fluent dropIndexCommand(string $command, string $type, string|array $index)

Create a new drop index command on the blueprint.

Parameters

string $command
string $type
string|array $index

Return Value

Fluent

protected string createIndexName(string $type, array $columns)

Create a default index name for the table.

Parameters

string $type
array $columns

Return Value

string

ColumnDefinition addColumn(string $type, string $name, array $parameters = [])

Add a new column to the blueprint.

Parameters

string $type
string $name
array $parameters

Return Value

ColumnDefinition

$this removeColumn(string $name)

Remove a column from the schema blueprint.

Parameters

string $name

Return Value

$this

protected Fluent addCommand(string $name, array $parameters = [])

Add a new command to the blueprint.

Parameters

string $name
array $parameters

Return Value

Fluent

protected Fluent createCommand(string $name, array $parameters = [])

Create a new Fluent command.

Parameters

string $name
array $parameters

Return Value

Fluent

string getTable()

Get the table the blueprint describes.

Return Value

string

ColumnDefinition[] getColumns()

Get the columns on the blueprint.

Return Value

ColumnDefinition[]

Fluent[] getCommands()

Get the commands on the blueprint.

Return Value

Fluent[]

ColumnDefinition[] getAddedColumns()

Get the columns on the blueprint that should be added.

Return Value

ColumnDefinition[]

ColumnDefinition[] getChangedColumns()

Get the columns on the blueprint that should be changed.

Return Value

ColumnDefinition[]

© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/5.8/Illuminate/Database/Schema/Blueprint.html