Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel4 migration column type of Date of Birth

I am very new in laravel.So this is gonna be very basic question.My question is what should be the column type in migration to create Date of Birth column.For example,I have created a migration file for Blood Donation,where the columns are something like that,

        $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();

you can see that laravel4 migration uses 'string' type instead of 'varchar'.so what should be the type of Date of birth column in laravel 4 ?

like image 835
Tanveer Avatar asked Jul 28 '14 11:07

Tanveer


1 Answers

Date would be the most suitable

$table->date('date_of_birth');
like image 63
Laurence Avatar answered Nov 11 '22 12:11

Laurence