Get what you need for the client and the user from the request as two separate arrays.
$client = $request->only(['something', 'something_else']);
$user = $request->only(['this', 'that']);
Client::create($client);
User::create($user);
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I'm building an API and I don't know which approach to take regarding form request. I have a users table which has name, lastname, email and password. The table has a polymorphic relationship with a users_admins table and users_clients table.
When I create a client, I need to create the user as well but all of it is sent in one request. How can I use two form requests (one for the users and one for the clients)?
What's the best way to approach this without mixing everything in one usersclients form request?
Please or to participate in this conversation.