artisticre
4 months ago

Eloquent Laravel

Posted 4 months ago by artisticre

I am going through a tutorial on eloquent and I have this store function created. My question is how do I have that data print to a success view after submit?

public function store(Request $request)
    {
        $this->validate($request, [
           'name' => 'required',
           'phone' => 'required',
           'email' => 'required',
           'message' => 'required'
           ]);
           $contact = new Contact;
           $contact->name = $request->input('name');
           $contact->phone = $request->input('phone');
           $contact->email = $request->input('email');
           $contact->message = $request->input('message');
           $contact->save();
     
       return redirect('contact/success')->with(compact('contact'))->with('success', 'Your Message Has Been Submitted');
    }

Please sign in or create an account to participate in this conversation.