<?php

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;

class ForgotPasswordNotification extends Mailable
{

    use Queueable, SerializesModels;

    protected $token;

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

    /**
     * Build the message.
     *
     * @return $this
     */
    public function build()
    {

        $resetUrl = config('app.url') . '/' . $this->token . '/reset-password';

        $body = "
            <p>
            Forgot your password? No problem!
            Just click the link below and you can create a new password.
            </p>
            <p><a href='{$resetUrl}'>  Reset Password </a></p>
            <p>The link will expire in 1 hour, so be sure to use it right away.</p>

                ";

        return $this->from(config('app.admin_mail', 'Admin'))
            ->subject('Reset Password')
            ->view('emails.auth.forgot_password_link')
            ->with([
                "body" => $body
            ]);
    }
}
