<?php

namespace App\Http\Controllers\Helpers;

use Illuminate\Routing\Controller;
use Mail;

class EmailHelperController extends Controller
{

    public function __construct()
    {
    }

    public function sendEmailForgotPassword($emailTo, $token)
    {
        // subject
        $subject = 'Forgot Password: The Greater Chiangmai : Has Sent You a Message! No reply This email';

        $details = [
            'email' => $emailTo,
            'link' => url('reset-password/' . $token),
        ];

        Mail::send('emails.forgot-password', $details, function ($message) use ($subject, $details) {
            $message->to($details['email'])
                ->subject($subject);
        });
    }

    public function sendEmailResetPassword($emailTo, $newPassword)
    {
        // subject
        $subject = 'Reset Password: The Greater Chiangmai : Has Sent You a Message! No reply This email';

        $details = [
            'email' => $emailTo,
            'password' => $newPassword,
        ];

        Mail::send('emails.reset-password', $details, function ($message) use ($subject, $details) {
            $message->to($details['email'])
                ->subject($subject);
        });
    }

    public function sendEmailCancelBooking($details)
    {

        // subject
        $subject = 'Cancel Booking: The Greater Chiangmai : Has Sent You a Message! No reply This email';


        Mail::send('emails.cancel-booking', $details, function ($message) use ($subject, $details) {
            $message->to($details['email'])
                ->subject($subject);
        });
    }


    public function sendEmailApproveBooking($details)
    {

        // subject
        $subject = 'Approve Booking: The Greater Chiangmai : Has Sent You a Message! No reply This email';


        Mail::send('emails.approve-booking', $details, function ($message) use ($subject, $details) {
            $message->to($details['email'])
                ->subject($subject);
        });
    }
}
