I added a column account_id with foreign key constraint onto the accounts table to my users table. For the registration process I now want the email to be first inserted into the accounts table. Then I want to populate the users table with the account_id and all other registration information.
My RegisterController.php looks like this:
protected function create(array $data)
{
$account = Account::create([
'email' => $data['email'],
]);
return User::create([
// 'name' => $data['name'],
'email' => $data['email'],
'password' => bcrypt($data['password']),
'account_id' => $accounts['id']
]);
}
This gives me the error Class 'App\Http\Controllers\Auth\Account' not found
when creating a new user.
I'm new to Laravel and am a bit lost here. Any pointers would be great!
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire