0

I had to use php artisan scout:import command, while I was developing the website in my local environment and everything worked perfectly. However, once I deployed my app and used the same command using ssh I got my model imported, but with int attributes rendered as strings, f.e. 1 was formatted as "1". Because of that, I fail to use numeric_filters. I use the MySql database in both cases.

1 Answers1

0

Numbers are rendered as the string in JSON response by default. You could either use instructions from this https://stackoverflow.com/questions/31527050/laravel-5-controller-sending-json-integer-as-string or you could use casts attributes in the model so every time model is serialized it will cast respective columns as specified.

E.g. In model, you can define something like this:
protected $casts = [ 'something' => 'float' ];

user10128333
  • 156
  • 4