gpt4 book ai didi

php - Date of Birth 类型的 Laravel 迁移列

转载 作者:可可西里 更新时间:2023-11-01 13:17:40 24 4
gpt4 key购买 nike

我是 laravel 的新手。所以这将是一个非常基本的问题。我的问题是迁移中的列类型应该是什么来创建 Date of Birth 列。例如,我创建了献血的迁移文件,其中的列是这样的,

        $table->increments('id');
$table->unsignedInteger('donner_id');
$table->foreign('donner_id')->references->('id')->on('users')->onDelete('cascade')->onUpdate('cascade');
$table->string('name');
$table->string('email')->unique();
$table->string('blood_group');
$table->string('phone_number')->unique();
$table->string('location');
$table-> ------('date_of_birth');
$table->timestamps();

你可以看到 laravel4 迁移使用 'string' 类型而不是 'varchar'。那么 laravel 4 中的出生日期列的类型应该是什么?

最佳答案

Date would be the most suitable

$table->date('date_of_birth');

关于php - Date of Birth 类型的 Laravel 迁移列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24994346/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com