Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace App\Services;
- use App\User;
- use Edujugon\PushNotification\PushNotification;
- use Illuminate\Mail\Mailer;
- use Illuminate\Mail\Message;
- use Illuminate\Support\Facades\Log;
- use Illuminate\Support\Facades\Config;
- class RegistrationService
- {
- protected $mailer, $notify;
- public function __construct(Mailer $mailer)
- {
- $this->mailer = $mailer;
- }
- public function sendOtp($otp, $mailTo)
- {
- try {
- $textMessage = str_replace('#OTP#', $otp, Config::get('constants.OTP_SMS_TEXT'));
- $data = [
- 'textMessage' => $textMessage
- ];
- $this->mailer->send("emails.otpVerification", $data, function (Message $m) use ($mailTo) {
- $m->to($mailTo)->subject("OTP Verification");
- });
- return true;
- } catch (\Exception $ex) {
- Log::info($ex->getMessage() . " = " . $ex->getLine());
- }
- }
- public function sendForgotPasswordOtp($otp, $mailTo)
- {
- try {
- $textMessage = str_replace('#OTP#', $otp, Config::get('constants.FORGOT_PASSWORD_OTP_TEXT'));
- $data = [
- 'textMessage' => $textMessage
- ];
- $this->mailer->send("emails.otpVerification", $data, function (Message $m) use ($mailTo) {
- $m->to($mailTo)->subject("Forgot Password");
- });
- return true;
- } catch (\Exception $ex) {
- Log::info($ex->getMessage() . " = " . $ex->getLine());
- }
- }
- public function sendClinicCredentials($email, $password)
- {
- try {
- $textMessage = Config::get('constants.CLINIC_REGISTER_MAIL_MESSAGE');
- $data = [
- 'textMessage' => $textMessage,
- 'username' => $email,
- 'password' => $password
- ];
- $this->mailer->send("emails.registerClinic", $data, function (Message $m) use ($email) {
- $m->to($email)->subject("Clinic Register");
- });
- return true;
- } catch (\Exception $ex) {
- Log::info($ex->getMessage() . " = " . $ex->getLine());
- }
- }
- public function sendDoctorCredentials($email, $password)
- {
- try {
- $textMessage = Config::get('constants.DOCTOR_REGISTER_MAIL_MESSAGE');
- $data = [
- 'textMessage' => $textMessage,
- 'username' => $email,
- 'password' => $password
- ];
- $this->mailer->send("emails.registerDoctor", $data, function (Message $m) use ($email) {
- $m->to($email)->subject("Doctor Register");
- });
- return true;
- } catch (\Exception $ex) {
- Log::info($ex->getMessage() . " = " . $ex->getLine());
- }
- }
- public function sendDoctorStatusUpdate($email, $status)
- {
- try {
- $textMessage = "Your Doctor Profile Status Changed to " . $status;
- $data = [
- 'textMessage' => $textMessage,
- ];
- $this->mailer->send("emails.statusDoctor", $data, function (Message $m) use ($email) {
- $m->to($email)->subject("Doctor Status Change");
- });
- return true;
- } catch (\Exception $ex) {
- Log::info($ex->getMessage() . " = " . $ex->getLine());
- }
- }
- public function sendReferralCode($referralCode, $patient_name, $mailTo, $android_link, $ios_link)
- {
- try {
- $data = [
- 'referralCode' => $referralCode,
- 'patient_name' => $patient_name,
- 'android_link' => $android_link,
- 'ios_link' => $ios_link,
- ];
- $this->mailer->send("emails.referFriend", $data, function (Message $m) use ($mailTo) {
- $m->to($mailTo)->subject("Referral code by patient");
- });
- return true;
- } catch (\Exception $ex) {
- Log::info($ex->getMessage() . " = " . $ex->getLine());
- }
- }
- public function sendCancelAppointment($mailTo, $body)
- {
- try {
- $textMessage = $body;
- $data = [
- 'textMessage' => $textMessage
- ];
- $this->mailer->send("emails.cancelAppointment", $data, function (Message $m) use ($mailTo) {
- $m->to($mailTo)->subject("Appointment Cancelled");
- });
- return true;
- } catch (\Exception $ex) {
- Log::info($ex->getMessage() . " = " . $ex->getLine());
- }
- }
- public function sendRescheduleAppointment($mailTo, $body)
- {
- try {
- $textMessage = $body;
- $data = [
- 'textMessage' => $textMessage
- ];
- $this->mailer->send("emails.cancelAppointment", $data, function (Message $m) use ($mailTo) {
- $m->to($mailTo)->subject("Appointment Rescheduled");
- });
- return true;
- } catch (\Exception $ex) {
- Log::info($ex->getMessage() . " = " . $ex->getLine());
- }
- }
- }
Add Comment
Please, Sign In to add comment