<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\Http\Controllers\Controller;
use App\Mail\ContactMail;
use Illuminate\Support\Facades\Mail;

class MailController extends Controller
{
    public function index(Request $request){
        
        $details = [
            'name' => $request->input('name'),
            'company' => $request->input('company'),
            'phone' => $request->input('phone'),
            'email' => $request->input('email'),
            'subject' => $request->input('subject'),
            'message' => $request->input('message')
        ];
       
        Mail::to('budi@j-logistik.com')->send(new ContactMail($details));
       
        $request->session()->flash('status', 'Thank you, we have received your message.');
        return view('contact');
    
    }
}
