F
Filament13mo ago
Alex

UPDATE query error when submitting form

Here is the error i'm getting: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '[]' for column 'requester_id' at row 1 update bookings SET requester_id = [], bookings.updated_at = 2023-11-01 09:11:48 WHERE id = 3 Flare link: https://flareapp.io/share/353BBd67 I'm not sure why it is trying to run this update query and what the point of it is. Immediately before, it successfully runs an INSERT query as expected that adds the booking to the database, including the correct requester_id that is selected within the form. Here is a Gist link to my BookingResource.php file: https://gist.github.com/alexb34n/adc3f7f26f7f94efccd26d6c1aa4f36f Apologies in advance if it's anything really simple. I'm relatively new to this so still finding my feet.
Flare
SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect integer value: '[]' for column magna.bookings.requester_id at row 1 (Connection: mysql, SQL: update bookings set requester_id = [], bookings.updated_at = 2023-11-01 09:17:23 where id = 39) - The error occurred at http://127.0.0.1:8000/admin/bookings/create
Gist
BookingResource.php
BookingResource.php. GitHub Gist: instantly share code, notes, and snippets.
1 Reply
Dennis Koch
Dennis Koch13mo ago
It's quite hard to find the issue in that much code. Maybe break it down as much as you can. Not sure why you are combining ->relationship() and ->options() on the Select. The relationship triggers a save to the relationship and might be where the error comes from.
Want results from more Discord servers?
Add your server