Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Passing parameters to integer?

In this migration:

Schema::create('user_closure', function(Blueprint $table)
        {
            $table->increments('closure_id');

            $table->integer('ancestor', false, true);
            $table->integer('descendant', false, true);
            $table->integer('depth', false, true);

        });

Can some one explain what does passing false, true mean to the integer filed ?

like image 581
simo Avatar asked Apr 25 '26 04:04

simo


1 Answers

The API references the second parameter as the auto increment and is by default to false. The third being the unsigned parameter by default set to false either.

This migration is equivalent to :

Schema::create('user_closure', function(Blueprint $table) {
    $table->increments('closure_id');
    $table->integer('ancestor')->unsigned();
    $table->integer('descendant')->unsigned();
    $table->integer('depth')->unsigned();
});

Which is more readable imo

like image 84
shempignon Avatar answered Apr 28 '26 04:04

shempignon



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!