I have AuthController in Laravel and I have 2 tables, one is Users and one is Users_Information and I want to insert into Users_Information upon registration.
So I want to get the id from the following method and insert a new row and set the column ID of that row to the ID of the user I have just created.
/**
* Create a new user instance after a valid registration.
*
* @param array $data
* @return User
*/
protected function create(array $data)
{
return User::create([
'username' => $data['username'] . ' ' . $data['username2'],
'mail' => $data['mail'],
'password' => bcrypt($data['password']),
]);
}
I want to insert into Users_Information with a column id, current_food and current_level
I have a controller for the Users_Information called UserInformation, would I just call UserInformation::create but how would I get the id from the User::create ?
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/24xJJ9i
via IFTTT
Aucun commentaire:
Enregistrer un commentaire