laravellaravel-5laravel-migrationslaravel-schema-builder

How to set the default value of an integer field to it's possible maximum?


Is there any way to set a maximum value as a default one for an integer field? In other words, I'm looking for a simple and elegant way to replace the hardcoded 999 value from the code below.

Schema::create('files', function(Blueprint $table)
{
    // . . .
    $table->integer('display_order')->default(999); // <-- MAX_VALUE instead of 999
    // . . .
});

Solution

  • You can see that PHP has Predefined Constants

    PHP_INT_MAX (integer) The largest integer supported in this build of PHP. Usually int(2147483647). Available since PHP 5.0.5