Php Laravel 5.8雄辩的Create()返回错误的Id
我已经将自动增量设置为开发中需要的一些值。 然后我用Laravel Elount创建了一个新记录Php Laravel 5.8雄辩的Create()返回错误的Id,php,laravel,laravel-5,eloquent,laravel-5.8,Php,Laravel,Laravel 5,Eloquent,Laravel 5.8,我已经将自动增量设置为开发中需要的一些值。 然后我用Laravel Elount创建了一个新记录 public function up() { Schema::create( 'active_stocks', function ( Blueprint $table ) { $table->bigIncrements( 'id' ); $table->string( 'sku' ); $table-
public function up() {
Schema::create( 'active_stocks', function ( Blueprint $table ) {
$table->bigIncrements( 'id' );
$table->string( 'sku' );
$table->text( 'title' )->nullable()->default( '' );
$table->integer( 'cost' )->default(0);
$table->integer( 'qty' )->default(0);
$table->string( 'stock_tracking' )->default('')->nullable();
$table->integer( 'type' )->default(1);
$table->text( 'image' )->nullable();
$table->integer( 'user_id' );
$table->integer( 'status' )->default(1);
$table->timestamps();
} );
\Illuminate\Support\Facades\DB::statement( "ALTER TABLE `active_stocks` AUTO_INCREMENT = 9999999999;" );
}
但我得到了这个2147483647
但我在数据库中查看了id值是9999999999
,这是正确的
我在这里错过了什么
这是$create的完整响应
$create = App/ActiveStock::create(
[
'sku' => $item_array['sku'],
'qty' => $item_array['qty'],
'stock_tracking' => $item_array['tracking'],
'type' => ActiveStock::TYPE_IMPORTED,
'cost' => $item_array['cost'],
'user_id' => $user_id,
]
)
echo $create->id; //Should be 9999999999
2147483647是32位有符号整数的最大值。
您可能正在使用32位版本的PHP。2147483647是32位有符号整数的最大值。
您可能正在使用32位版本的PHP。您正在访问的文件中的数字太大
2147483647
是32位int
的最大限制如果要存储并使用大于此值的数字,可能需要将列类型从
int
更改为类似varchar(100)
的值,您正在访问的列中的数字太大2147483647
是32位int
的最大限制如果您想存储并使用大于此值的数字,您可能需要将列类型从
int
更改为类似varchar(100)
的内容,这与PHP无关。这是一个特定于系统的问题。任何试图使用大于32位系统限制的int的应用程序都会导致这种行为。这与PHP无关。这是一个特定于系统的问题。任何试图使用大于32位系统限制的int的应用程序都会导致此类行为。
App\ActiveStock Object
(
[fillable:protected] => Array
(
[0] => sku
[1] => title
[2] => cost
[3] => qty
[4] => stock_tracking
[5] => type
[6] => image
[7] => user_id
[8] => status
)
[connection:protected] => mysql
[table:protected] => active_stocks
[primaryKey:protected] => id
[keyType:protected] => int
[incrementing] => 1
[with:protected] => Array
(
)
[withCount:protected] => Array
(
)
[perPage:protected] => 15
[exists] => 1
[wasRecentlyCreated] => 1
[attributes:protected] => Array
(
[sku] => test-B00MSOIUOO
[qty] => 11
[stock_tracking] =>
[type] => 1
[cost] => 112
[user_id] => 1
[updated_at] => 2020-02-08 17:12:38
[created_at] => 2020-02-08 17:12:38
[id] => 2147483647
)
[original:protected] => Array
(
[sku] => test-B00MSOIUOO
[qty] => 11
[stock_tracking] =>
[type] => 1
[cost] => 112
[user_id] => 1
[updated_at] => 2020-02-08 17:12:38
[created_at] => 2020-02-08 17:12:38
[id] => 2147483647
)
[changes:protected] => Array
(
)
[casts:protected] => Array
(
)
[dates:protected] => Array
(
)
[dateFormat:protected] =>
[appends:protected] => Array
(
)
[dispatchesEvents:protected] => Array
(
)
[observables:protected] => Array
(
)
[relations:protected] => Array
(
)
[touches:protected] => Array
(
)
[timestamps] => 1
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
)