<?php

namespace App\Core\Mail;


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

use Illuminate\Support\Facades\Log;

class UserForgotPassword extends Mailable
{

    use Queueable, SerializesModels;

    public $tries = 5;
    public $timeout = 30;

    protected $param;


    public function __construct($param)
    {
        $this->param = $param;
    }

    public function build ()
    {
        try
        {
            $params = $this->param;
            app('translator')->setLocale($params["language"]);
            return $this->view('emails.userForgotPassword', compact('params'))
                ->to($params["email"], $params["name_surname"])
                ->subject(__('api-mailing-user_forgot_password_subject'))
                ->with(['message' => $this]);

        }
        catch ( Exception $e )
        {
            $message = $e->getFile()." ".$e->getLine()." ".$e->getMessage();
            Log::error($message);
            return output( ['status' => -1, 'message' => $e->getMessage()] );
        }
    }

}
