This is my current code.
public function up()
{
Schema::table('render', function (Blueprint $table) {
$table->boolean('displayed')->default(1);
});
}`
How to change the default value to 0 as below?
public function up()
{
Schema::table('render', function (Blueprint $table) {
$table->boolean('displayed')->default(0);
});
}
public function up()
{
Schema::table('render', function (Blueprint $table) {
$table->boolean('displayed')->default(0)->change();
});
}
Added ->change(). Please see Link
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->boolean('is_active')->unsigned()->nullable();
$table->timestamps();
});
is_active column is defined as a nullable boolean column using the boolean data type and the unsigned modifier. This will allow you to use the true and false keywords in your database queries instead of 0 and 1.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With