Skip to content

Tag: laravel

Laravel – API return fields as string while they are int in the DB

I have the following code: In the DB, most of the fields of the DailyMission / userProgress models are integers – but the API return them as string. for example: instead of: Any idea what can cause this issue? Version: Answer In your model, you should define the field as an integer in the $cast attribut…