Reputation: 2180
I want to add a default value to a column while creating a migration.
How can I do this? Help me please.
Upvotes: 2
Views: 2884
Reputation: 163
->default($value)
is what you need.
Specify a "default" value for the column. Like
$table->boolean('is_verified')->default(0);
Hope this helps!
Upvotes: 4
Reputation: 163748
Add ->default($value)
to your clause, for example:
$table->text('description')->default('There is no description yet');
https://laravel.com/docs/5.2/migrations#writing-migrations
Upvotes: 1
Reputation: 261
follow this Faker link. here You can create and initialize a faker generator, which can generate data by accessing properties named after the type of data you want.
Upvotes: 0