Level 33
If you have the right relations you could do it like this:
public function store()
{
$user->visit()->attach($visitId);
}
1 like
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I got 3 tables user , visit and then user_visit (many to many).
I want to make a user, and when i add a user i also want to update the visit table (and user_visit ofc.)
So how will my controller look like?
My views and model is all right, i only need to see how the Controller will look like :)
Anyone know, or know a video/text where i can learn it?
Please or to participate in this conversation.