Home > Blockchain >  What is the meaning of nullable() in Laraval migration?
What is the meaning of nullable() in Laraval migration?

Time:02-17

What is the meaning of nullable() in Laraval migration? For example, this is in our migration:

$table->string('middle_name')->nullable();

CodePudding user response:

It will make the column nullable in the database which means you can store null values to that column or also can be said that it is not a mandatory field in database

CodePudding user response:

It means the middle_name field can also store null values: as in inserting a value is not required.

Imagine a registration form for example. Not everybody has a middle name. So in that case they would leave the middle_name field empty and in the database it'll be null.

  • Related