/** * Handle the event. * * @param UserHasRegistred $event * @return void */ public function handle(UserHasRegistred $event) { $this->mailer->sendWelcomeEmailTo($event->user, $event->password); // $data = [ // 'user_firstname' => $event->user_firstname, // 'user_lastname' => $event->user_lastname, // 'email' => $event->email, // 'password' => $event->password, // 'user_phone' => $event->user_phone // ]; // Mail::send('emails.register', $data, function($message) // { // $message->to('*****@*****.**', 'Rolands Zeltins')->subject('Welcome to gomodel.es'); // }); }
public function sendWellcomeSmsWithPasswordToRegistredUser(User $user, $password) { $smsGateway = new SmsGateway(env('SMS_GATEWAY_EMAIL'), env('SMS_GATEWAY_PW')); $user_first_last_name = $user->user_firstname . ' ' . $user->user_lastname; $smsGateway->createContact($user_first_last_name, $user->user_phone); $data[] = ['device' => $this->getSmsGatewayDeviceIdBasedOnCarrier($user, $password), 'number' => $user->user_phone, 'message' => $user->user_firstname . '! Wellcome to gomodel.es your registration have been sucesful! Please replay us back to this SMS with your email address, to confirm your emails, mobile phone number.']; $data[] = ['device' => $this->getSmsGatewayDeviceIdBasedOnCarrier($user, $password), 'number' => $user->user_phone, 'message' => 'Login in to your profile using thea' . 's' . ' credentials. Email:' . $user->email . ' Password:'******' Your gomodel.es team!']; $data[] = ['device' => $this->getSmsGatewayDeviceIdBasedOnCarrier($user, $password), 'number' => $user->user_phone, 'message' => 'You can save this number as gomodel.es so you know next time from who these messages are! gomodel.es super-team!', 'send_at' => strtotime('+1 minutes')]; $result = $smsGateway->sendManyMessages($data); if ($this->getSmsGatewayDeviceIdBasedOnCarrier($user, $password) == false) { $this->mailer->sendWelcomeEmailTo($user, $password); Flash::success('You have registred! Your login credentials have been sent to your e-mail'); } else { Flash::success('You have registred! Your login credentials will be sent to your mobile phone number'); } }