Cách sử dụng các loại cột di chuyển của laravel với các ví dụ

Trong bài viết này, tôi sẽ trình bày cách sử dụng đúng Cách định dạng các loại cột di chuyển bằng ví dụ bằng cách cung cấp ví dụ cho 1

Cách sử dụng các loại cột di chuyển của laravel với các ví dụ
# nullableTimestamps()
## alias of the timestamps method
	$table->nullableTimestamps(0);

# nullableMorphs()
## The method is similar to the morphs method 
## however, the columns that are created will be "nullable":
	$table->nullableMorphs('taggable');

# nullableUuidMorphs()
## The method is similar to the uuidMorphs method
## however, the columns that are created will be "nullable":
    $table->nullableUuidMorphs('taggable');

# point()
## creates a POINT equivalent column:
    $table->point('position');

# polygon()
## creates a POLYGON equivalent column:
    $table->polygon('position');

# rememberToken()
## creates a nullable, VARCHAR(100) equivalent column 
## that is intended to store the current "remember me" authentication token:
    $table->rememberToken();

# set()
## creates a SET equivalent column with the given list of valid values:
    $table->set('flavors', ['strawberry', 'vanilla']);

# smallIncrements()
## creates an auto-incrementing UNSIGNED SMALLINT 
## equivalent column as a primary key:
    $table->smallIncrements('id');

# smallInteger()
## creates a SMALLINT equivalent column:
    $table->smallInteger('votes');

# softDeletesTz()
## adds a nullable deleted_at TIMESTAMP (with timezone) equivalent column 
## with an optional precision (total digits). 
## This column is intended to store the deleted_at timestamp 
## needed for Eloquent's "soft delete" functionality:
    $table->softDeletesTz($column = 'deleted_at', $precision = 0);

# softDeletes()
## adds a nullable deleted_at TIMESTAMP 
## equivalent column with an optional precision (total digits). 
## This column is intended to store the deleted_at timestamp 
## needed for Eloquent's "soft delete" functionality:
    $table->softDeletes($column = 'deleted_at', $precision = 0);

# string()
## creates a VARCHAR equivalent column of the given length:
    $table->string('name', 100);

# text()
## creates a TEXT equivalent column:
    $table->text('description');

# timeTz()
## creates a TIME (with timezone) 
## equivalent column with an optional precision (total digits):
    $table->timeTz('sunrise', $precision = 0);

# time()
## creates a TIME equivalent column with an optional precision (total digits):
    $table->time('sunrise', $precision = 0);

# timestampTz()
## creates a TIMESTAMP (with timezone) 
## equivalent column with an optional precision (total digits):
    $table->timestampTz('added_at', $precision = 0);

# timestamp()
## creates a TIMESTAMP equivalent column 
## with an optional precision (total digits):
    $table->timestamp('added_at', $precision = 0);

# timestampsTz()
## creates created_at and updated_at TIMESTAMP 
## (with timezone) equivalent columns with an optional precision (total digits):
    $table->timestampsTz($precision = 0);

# timestamps()
## creates created_at and updated_at TIMESTAMP 
## equivalent columns with an optional precision (total digits):
    $table->timestamps($precision = 0);

# tinyIncrements()
## creates an auto-incrementing UNSIGNED TINYINT 
## equivalent column as a primary key:
    $table->tinyIncrements('id');

# tinyInteger()
## creates a TINYINT equivalent column:
    $table->tinyInteger('votes');

# tinyText()
## creates a TINYTEXT equivalent column:
    $table->tinyText('notes');

# unsignedBigInteger()
## creates an UNSIGNED BIGINT equivalent column:
    $table->unsignedBigInteger('votes');

# unsignedDecimal()
## creates an UNSIGNED DECIMAL equivalent column with 
## an optional precision (total digits) 
## and scale (decimal digits):
    $table->unsignedDecimal('amount', $precision = 8, $scale = 2);

# unsignedInteger()
## creates an UNSIGNED INTEGER equivalent column:
    $table->unsignedInteger('votes');

# unsignedMediumInteger()
## creates an UNSIGNED MEDIUMINT equivalent column:
    $table->unsignedMediumInteger('votes');

# unsignedSmallInteger()
## creates an UNSIGNED SMALLINT equivalent column:
    $table->unsignedSmallInteger('votes');

# unsignedTinyInteger()
## creates an UNSIGNED TINYINT equivalent column:
    $table->unsignedTinyInteger('votes');

# uuidMorphs()
## The uuidMorphs method is a convenience method that adds a 
## {column}_id CHAR(36) equivalent column and a {column}_type 
## VARCHAR equivalent column.
## This method is intended to be used when defining the columns necessary 
## for a polymorphic Eloquent relationship that use UUID identifiers. 
## In the following example, `taggable_id` and `taggable_type` columns would be created:
    $table->uuidMorphs('taggable');

# uuid()
## creates a UUID equivalent column:
    $table->uuid('id');

# year()
## creates a YEAR equivalent column:
    $table->year('birth_year');

Các ví dụ khác xoay quanh chủ đề Cách di chuyển các loại cột trong laravel với các ví dụ được nhiều người quan tâm

Làm cách nào để thay đổi loại cột khi di chuyển với Laravel?

Làm cách nào để thay đổi loại cột trong laravel? .
Bước 1. Cài đặt gói Doct/dbal
Bước 2. Tạo tệp di chuyển
Bước 3. Mở tệp di chuyển được tạo và cập nhật
Bước 3. Chạy di chuyển

Làm cách nào để thay đổi các cột trong quá trình di chuyển?

Làm cách nào để thay đổi loại dữ liệu của cột trong quá trình di chuyển laravel 9? .
Bước 1. Cài đặt gói Doct/dbal. .
Bước 2. Tạo tệp di chuyển. .
Bước 3. Mở tệp di chuyển được tạo và cập nhật. .
Bước 3. Chạy di chuyển

Làm cách nào để thêm một cột trong quá trình di chuyển Laravel?

Việc di chuyển Laravel sẽ sử dụng mặt tiền Schema để tạo và sửa đổi các bảng và cột cơ sở dữ liệu. Lược đồ. create('tasks', function (Blueprint $table) { $table->bigIncrements('id'); $table->timestamps(); }); Bên trong mặt tiền, bạn có thể .

Làm cách nào để thay đổi một cột thành nullable trong quá trình di chuyển Laravel?

Lược đồ. table('users', function($table) { $table->string('name', 50)->nullable()->change(); }); Đây là . $table->integer('user_id')->unsigned()->nullable(false)->change();