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

1k Views Asked by At

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
    // . . .
});
1

There are 1 best solutions below

0
On BEST ANSWER

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