I am new to Laravel. I want to register the account so I have one form that has the details about the username, email, password, company name, and other company details. I got 2 tables in my database. Table 1 is the user table which is used to store the user details to log in like userID, email, password, and companyID (from table 2). Table 2 is the company table that stores company details. Table 2 has companyID, companyName, and so on. I want to ask how can I use one form to save my data in two different tables.
Here is the code from RegisterController
protected function create(array $data)
{
return User::create([
'username' => $data['name'],
'email' => $data['email'],
'password' => bcrypt($data['password']),
]);
}