Skip to content

Instantly share code, notes, and snippets.

@dahngeek
Created September 28, 2021 16:52
Show Gist options
  • Save dahngeek/03a71de788032dfe8f05d34c86fc163b to your computer and use it in GitHub Desktop.
Save dahngeek/03a71de788032dfe8f05d34c86fc163b to your computer and use it in GitHub Desktop.
Fix different json format in between mysql versions. Different request json formats, one without quotes and the other with quotes, same code. That happemed to me in two different installations, its supposed to be because different mysql versions. one with native driver, one with normal: 5.7.24-ndb-7.6.8 vs Distrib 5.7.33
https://stackoverflow.com/questions/26974914/laravel-eloquent-integers-returned-as-strings-in-mssql
cast the specific properties you want as ints.
protected $casts = [
'id' => 'integer',
'owner_id' => 'integer',
'is_local' => 'integer',
'vessel_type_id' => 'integer',
'registration_number' => 'integer',
'gross_register_tonnage' => 'integer',
'year_built' => 'integer',
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment