<?php
namespace App\Mail;

use App\User;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
use App\Services\Util;

class MailContact extends Mailable
{
    use Queueable, SerializesModels;

    public $user_shop;
    public $subject;
    public $data;


    public function __construct($data)
    {
        $this->data = $data;
        $this->subject = __('email.your_request_from').' gruene-seele.bio';

    }

    public function build()
    {
        $salutation = __('email.hello');
        if(isset($this->data['first_name'])){
            $salutation .= " ".$this->data['first_name'];
        }

        if(isset($this->data['salutation'])){
            if($this->data['salutation'] === 'mr'){
                $this->data['salutation'] = 'Herr';
            }
            if($this->data['salutation'] === 'ms'){
                $this->data['salutation'] = 'Frau';
            }
        }
        $copy1line = __('email.your_request_from')." gruene-seele.bio";


        return $this->view('emails.contact')->with([
            'salutation' => $salutation,
            'copy1line' => $copy1line,
            'data' => $this->data,
            'copy3line' => __('email.copy3line'),
            'greetings' => __('email.greetings'),
            'sender' => __('email.sender'),
        ]);
    }
}