Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

laravel contact form backend

raminismayilsoy answered on May 5, 2023 Popularity 1/10 Helpfulness 1/10

Contents


More Related Answers

  • laravel send back with message
  • laravel controller return message
  • laravel redirect back with input
  • laravel redirect back with errors and input
  • redirect back with input laravel in request
  • Laravel contact us

  • laravel contact form backend

    0

    namespace App\Http\Controllers;

    use Illuminate\Http\Request;

    use App\Models\Contact;

    class ContactUsFormController extends Controller {

    // Create Contact Form

    public function createForm(Request $request) {

    return view('contact');

    }

    // Store Contact Form data

    public function ContactUsForm(Request $request) {

    // Form validation

    $this->validate($request, [

    'name' => 'required',

    'email' => 'required|email',

    'phone' => 'required|regex:/^([0-9\s\-\+\(\)]*)$/|min:10',

    'subject'=>'required',

    'message' => 'required'

    ]);

    // Store data in database

    Contact::create($request->all());

    //

    return back()->with('success', 'We have received your message and would like to thank you for writing to us.');

    }

    }

    Popularity 1/10 Helpfulness 1/10 Language php
    Source: Grepper
    Link to this answer
    Share Copy Link
    Contributed on May 05 2023
    raminismayilsoy
    0 Answers  Avg Quality 2/10


    X

    Continue with Google

    By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
    X
    Grepper Account Login Required

    Oops, You will need to install Grepper and log-in to perform this action.