1

I have a table, and one of the columns is request_id, which is defined in a migration like this:

$table->bigInteger('request_id')->index()->unsigned()->nullable();

And when I look on phpmyadmin at the table structure, it says

bigint(20)      UNSIGNED

I'm making a request to my api, and sending through this value: 1562247865319

$requestLog = new RequestLog();
$requestLog->request_id = 1562247865319;
$requestLog->save();

This code is erroring and sending back Numeric value out of range: 1264 Out of range

What's really strange is that when I'm in phpmyadmin, I can manually set the value of that column to much bigger values than 1562247865319, but when I do it through my laravel model it doesn't like it.

edit

error message is

SQLSTATE[22003]: Numeric value out of range: 1264 Out of range value for column 'request_id' at row 1 (SQL: insert into `request_logs` (`ip`, `submitted_user_name`, `url`, `full_url`, `method`, `request_id`, `request_data`, `api_user_id`, `updated_at`, `created_at`) values (..., ..., ..., http://..../api/..., POST, 1562247865319, {"request_id":"1562248616206"}, 2, 2019-07-04 14:57:00, 2019-07-04 14:57:00))
TKoL
  • 13,158
  • 3
  • 39
  • 73

1 Answers1

0

I think this issue is the same than this.

Try to change any UNSIGNED ints to SIGNED.

Alexandre Paiva
  • 987
  • 2
  • 10
  • 24