Guest User

controller

a guest
Sep 24th, 2020
8
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. namespace App\Http\Controllers;
  4. use Illuminate\Http\Request;
  5. use Illuminate\Support\Facades\Mail;
  6. use App\Contact;
  7.  
  8.  
  9. class ContactUsFormController extends Controller {
  10.  
  11.     // Create Contact Form
  12.     public function createForm(Request $request) {
  13.       return view('pages.contact');
  14.     }
  15.  
  16.     // Store Contact Form data
  17.     public function ContactUsForm(Request $request) {
  18.  
  19.         // Form validation
  20.         $this->validate($request, [
  21.             'name' => 'required',
  22.             'email' => 'required|email',
  23.             'subject'=>'required',
  24.             'message' => 'required'
  25.          ]);
  26.  
  27.         //  Store data in database
  28.         Contact::create($request->all());
  29.  
  30.      
  31.  
  32.         return back()->with('success', 'Dziękujemy za wiadomość, wkrótce odpowiemy.');
  33.     }
  34.  
  35. }
RAW Paste Data