Find () on the model gives id as a string in one environment, and int in another

I am using Laravel 5 and have a model Book.

I have two environments - dev and production

In dev: In tinkerwhen I do

Book::first()

It gives me

App\Book {
     id: 1,
     name: ...

By product: The same gives me

App\Book {
         id: "1",
         name: ...

Please note that idthere is intin dev, but stringin production

Because of this, the condition seems to be

if($id === $book->id)

which works correctly on dev does not work on production.

Any idea why this is so? Is there any way to get the working environment to give me intinstead string?

PS:

  • Laravel dev, git. , composer.json composer.lock , dev production. composer install ​​ , dev.
  • mysql.
  • Dev Laravel homestead.
  • Book - , . , .
+4
1

, , . , mysqlnd ( , MySQL, ) .

+2

All Articles