-1

I'm migrating an app from straight PHP to using Laravel. The current users table is called Person with the primary key person_id which is of unsigned bigint(20) type.

I've updated my App\User model with the following:

protected $table = 'Person';
protected $primaryKey = 'person_id';

Whenever I make a request and inspect Auth->user(), the person_id is always the wrong value. My expected id is 4294967410 but it's returning 2147483647. All other attributes on the user are correct (email, name, etc...).

I'm very stuck as to why this is the case. I'm using a fresh install of laravel.

circuitBurn
  • 893
  • 11
  • 24

1 Answers1

0

Related if not duplicate of What's the maximum size for an int in PHP?

You are getting PHP_INT_MAX which is 2147483647 on 32 bit machines.

For example on my Mac the int limit is:

Psy Shell v0.9.4 (PHP 7.1.14 — cli) by Justin Hileman
>>> echo PHP_INT_MAX
9223372036854775807⏎

Solution is to use 64 bit machine with 64 bit PHP build.

Kyslik
  • 8,217
  • 5
  • 54
  • 87