<?php

namespace App\Notifications;

use App\Booking;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
use Illuminate\Support\Facades\Storage;

class UploadPo extends Notification
{

    /** @var Booking */
    private $booking;

    /**
     * UploadPo constructor.
     * @param Booking $booking
     */
    public function __construct(Booking $booking)
    {
        $this->booking = $booking;
    }

    public function via()
    {
        return 'mail';
    }


    /**
     * Build the mail representation of the notification.
     *
     * @param  mixed  $notifiable
     * @return \Illuminate\Notifications\Messages\MailMessage
     */
    public function toMail($notifiable)
    {
        $message = new MailMessage;
        $message->subject('Upload PO - Exchange');
        $message->line('您好, 订单号 : '.$this->booking->id.' 的人民币汇款已成功。 请在这个网址 http://exchange.cief-malaysia.com/ 登录您的账号，并点击以下按钮，上载PO到系统. 谢谢.')
            ->line('The payment to your supplier for the order no: '.$this->booking->id.' has been successful, please login to your account at http://exchange.cief-malaysia.com/ and then click on the button below to upload your order\'s po');
        $message->action('Upload PO', 'https://exchange.cief-malaysia.com/booking/'.$this->booking->id.'/upload-po');
        return $message;
    }
}
