You'll want some relationships on those so you can automatically create them both and assign them to each other.
Have you got any code done so far? Relationships?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi.
I am building a sign up form which consists of a number of input fields imcluding.
When the form is submitted I need to create a new Company in the Companies table and a new User within the Users table.
Currently I have 3 controllers. JoinController which receives the form input, UserController and CompanyController. The User controller is also used elsewhere in the application.
My problem is that I don't want to go down the route of doing something like $user = new User(); and $company = new Company(); in order to populate the database from within the Joincontroller as this should be taken care of by the User and Company controllers themselves. I need a way to pass the appropriate fields from the JoinController into each of the UserController and CompanyController's. I know controllers aren't supposed to talk to each other so i'm stumped on how to achieve this.
Any advice very much welcome.
Thanks
Please or to participate in this conversation.