18

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 ?

1 Answer 1

39

Date would be the most suitable

$table->date('date_of_birth');
1
  • is it as simple as that?
    – Tanveer
    Jul 28, 2014 at 11:39

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.