%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/PasswordResetNotification.php

<?php

namespace App\Notifications;

use App\Models\Department;
use App\Tenancy;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;

class PasswordResetNotification extends Notification implements ShouldQueue
{
    use Queueable;

    private $token;
    private $department;

    /**
     * PasswordResetNotification constructor.
     * @param $token
     */
    public function __construct($token, $department)
    {
        $this->token = $token;
        $this->department = $department;
        $department = Department::getByCode($this->department);
        if ($department) {
            Tenancy::setDBConnection($department);
        }
    }

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

    /**
     * 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'))
                                ->subject('Klinisol - Setup Account')
                                ->line('Click the below button to setup your account. If this request was not initiated by you, please ignore this email.')
                                ->action('Choose your password', url("/redirect?token=$this->token&department=$this->department"))
                                ->line('Confirm!');
    }

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

Zerion Mini Shell 1.0