vendredi 28 avril 2017

How to send the password to a new user to his\her email in laravel 5.1?

following the question, i am trying this in my AuthController,

    protected function create(array $data)
{
    $randomPassword = Hash::make(str_random(8)); // generating random password
    return $user = User::create([
        'name' => $data['name'],
        'apellido' => $data['apellido'],
        'cedula' => $data['cedula'],
        'usuario' => $data['usuario'],
        'telefono' => $data['telefono'],
        'cargo' => $data['cargo'],
        'email' => $data['email'],
        'password' => bcrypt($randomPassword), // encrypting the password.
    ]);
        Mail::send('auth.Contraseña_NuevoUsuario', $randomPassword, function($message) {
        $message->to($data['email'], $data['usuario'])
        ->subject('Verify your email address');
    });  }

The register is doing well, but for some reason is not sending the email with the password to the new user, my .env and mail.php are already configured to send emails and is working fine for the password recovery, But here in this problem is not sending email, what can be??? please a need some help with this.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire