Laravel4迁移列类型的出生日期

问题描述 投票:4回答:1

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

        $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中出生日期列的类型应该是什么?

php laravel-4 migration
1个回答
7
投票

Date would be the most suitable

$table->date('date_of_birth');
© www.soinside.com 2019 - 2024. All rights reserved.