problem with user_id
Cannot add or update a child row: a foreign key constraint fails
12 Replies



You are trying to insert a row without a user_id
I want to get my user_id from the users table.

I worked in filament, but I forgot. I worked a year ago, and if you don't practice, you forget.
share the code. where is this happens? is this in a relation manager or a form? maybe you need a select for the user id? or you want the user_id from the session?
I want it to somehow, when a post is created, take the user_id that is logged in, and show my name after it.
if you're using a resource, then check this:
https://filamentphp.com/docs/3.x/panels/resources/creating-records#customizing-data-before-saving
That's how chatgpt gave me, and it still didn't work, maybe the project is compromised, I don't know
Anyway, it's a project for college, and I have to present it in 10 minutes, I don't know if I'll continue it, maybe to practice.
Wow this thread is wild. ChatGPT + Limewire ?! What a combination of old and new!