I am using Laravel 5 and have a model Book.
I have two environments - dev and production
On dev: In tinker, when I do
Book::first()
It gives me
App\Book {
id: 1,
name: ...
On produvction: The same thing gives me
App\Book {
id: "1",
name: ...
Notice the id is int in dev but string on production
Because of this, a condition like
if($id === $book->id)
which works correctly on dev, doesn't work on production.
Any idea why this is so? Is there a way I can make production environment to give me int instead of string?
PS:
- I have installed Laravel on dev and then pulled the code on production via git. So my
composer.jsonandcomposer.lockare exactly same on dev and production. So runningcomposer installon production should give me same environment there as on dev. - My dev environment is Laravel's
homestead. Bookis just a dummy model I've used here. All my models behave in the same manner as explained above.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire