I'm sending data with FormData object to my laravel backend, issue is I have a checkbox input which is causing me trouble, my backend logs the following error message:
SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect integer value: 'true' for column 'isVisible' ...
In my migrations isVisible field is declared as a boolean:
$table->boolean('isVisible')->default(false);
If I hack into the payload and send an 1 instead of 'true' or 0 instead of 'false' my Post entry is created succesfully.
Any idea how I can solve this?
TRUE/FALSEwithout quotes. By quoting the values, you're sending them as strings as boolean values. - aynberisVisibleshould betinyintwith the length1and default value0. Now you can store the values either by usingTRUEorFALSEor even1or0WITHOUT QUOTING. - Assad Ullah Ch