Why is production from the database it returns a string and not a number?

Use larabel, I have table in database with fields int and returns type int
It is on the local machine. But when I do the same on the production server returns the row and because of this many breaks in the program.

PS our database there if you look at the value of all fields as int


Here is the code receiving records from a database
$promocode = Promocode::where('code', '=', $code)->first();

Here is the answer on the local server

Here is the answer in production
April 4th 20 at 00:56
2 answers
April 4th 20 at 00:58
To get the numbers you need to comply with several conditions

- mysqlnd driver is installed
- disable emulation of prepared statements in PDO
- use the prepared query.
April 4th 20 at 01:00
If there is no possibility to change server settings, which is important in the case of virtual hosting, the problem can be solved by setting the casts in the model. Googly Laravel model casting attributes
Already did so) - Penelope98 commented on April 4th 20 at 01:03

Find more questions by tags PHP