<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Http\Requests\ContactRequest;
use App\Models\Feedback;


class ContactController extends Controller{
    public function submit(ContactRequest $req){
        $contact = new Feedback();
        $contact->name = $req->input('name');
        $contact->email = $req->input('email');
        $contact->subject = $req->input('subject');
        $contact->message = $req->input('message');

        $contact-> save();

        return redirect()->route('home')->with('success','Спасибо за сообщение');
    }
public function allData(){
    return view('messages',['data'=>Feedback::all();
}

}
