Hello -
$table->string('lastname')->default('<whatever default value in here>');
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Iam trying to create new field with datatype in existing table, i have done the migration and created new field but i can't give it's default value or datatype for newly created field can any one help me to do this..
artisan command i have written:
php artisan make:migration add_firstname_to_users --table-users
My migration file up function looks like:
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->string('lastname');
});
}
how can i declare dataype and it's default value for this newly created lastname..
Please or to participate in this conversation.