I am pretty clue less when it comes to Laravel I've been trying to get this working for sometime now and have just gotten error after error.
My end goal is to have some custom code run upon registration that puts the password in plain text (as an example) into a database (as an example). This is because I need to send there password off to an API which will create an account for them on another platform aswell.
This is the code I'm working with:
/**
* Handle a registration request for the application.
*
* @param RegisterRequest $request
* @param RoleRepository $roles
* @return \Illuminate\Http\Response
*/
public function postRegister(RegisterRequest $request, RoleRepository $roles)
{
// Determine user status. User's status will be set to UNCONFIRMED
// if he has to confirm his email or to ACTIVE if email confirmation is not required
$status = settings('reg_email_confirmation')
? UserStatus::UNCONFIRMED
: UserStatus::ACTIVE;
$role = $roles->findByName('User');
// Add the user to database
$user = $this->users->create(array_merge(
$request->only('username', 'password'),
['status' => $status, 'role_id' => $role->id]
));
event(new Registered($user));
//My Custom Code
$conn = mysqli_connect('localhost', 'u_dev', 'dbpassword', 'dev');
$stmt = $conn->prepare('INSERT INTO ironlogin (ironlogin_password) VALUES (?)');
$stmt->bind_param('s', $ironPassword);
$stmt->execute();
$stmt->close();
$conn->close();
//End My Custom Code
$message = settings('reg_email_confirmation')
? trans('app.account_create_confirm_email')
: trans('app.account_created_login');
return redirect('login')->with('success', $message);
}
I am stuck on how I'd go about putting the users password into that database for example.