%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /var/www/html/klinisol/klinisol-api/app/Notifications/
Upload File :
Create Path :
Current File : /var/www/html/klinisol/klinisol-api/app/Notifications/PatientAddedNotification.php

<?php

namespace App\Notifications;

use App\Models\Patient;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Messages\NexmoMessage;
use Illuminate\Notifications\Notification;
use NotificationChannels\Twilio\TwilioChannel;
use NotificationChannels\Twilio\TwilioSmsMessage;

class PatientAddedNotification extends Notification implements ShouldQueue
{
    use Queueable;

    private $patient;

    /**
     * Create a new notification instance.
     *
     * @return void
     */
    public function __construct(Patient $patient)
    {
        $this->patient = $patient;
    }

    /**
     * Get the notification's delivery channels.
     *
     * @param mixed $notifiable
     * @return array
     */
    public function via($notifiable)
    {
        return ['mail', TwilioChannel::class];
    }

    /**
     * Get the mail representation of the notification.
     *
     * @param mixed $notifiable
     * @return \Illuminate\Notifications\Messages\MailMessage
     */
    public function toMail($notifiable)
    {
        return (new MailMessage)->from(env('MAIL_FROM_ADDRESS'), env('MAIL_FROM_NAME'))
                                ->greeting('Hello ' . $this->patient->name . ' ' . $this->patient->surname . '!')
                                ->subject('Klinisol - Setup Account')
                                ->line('Click the below button to download the Klinisol Application. Your patient code is ' . $this->patient->code . '. If this request was not initiated by you, please ignore this email.')
                                ->action('Download', url('/redirect'))
                                ->line('Thank you for using our application!!');
    }

    /**
     * Get the array representation of the notification.
     *
     * @param mixed $notifiable
     * @return array
     */
    public function toArray($notifiable)
    {
        return [//
        ];
    }

    public function toNexmo($notifiable)
    {
        return (new NexmoMessage())->content('Your patient code is ' . $this->patient->code . '.');
    }

    public function toTwilio($notifiable)
    {
        return (new TwilioSmsMessage())->content("Your patient code is '{$this->patient->code}'!");
    }
}

Zerion Mini Shell 1.0