samedi 2 mars 2019

How to store data after confirm screen page

This is contact form. I would like to recive email and save this data to my mysql. I use Laravel. Email function works good. but There is a problem. I would like to store all data at "function complete". I validate all data at "function confirm" This is confirm screen page so user still not submit yet. I tried to write code like this at "function complete" but error say "Undefined variable: request" Could you teach me how to fix my code please?

public function confirm(Request $request)
    {
      $rules = [   
        'title' => 'required',
            'search' => 'required',
            'amount' => 'required|integer',
            'email' => 'required|email',
        'body' => 'required',
      ];

      $this->validate($request, $rules); 

      $data = $request->all(); 
      $request->session()->put($data); 
      return view('mail.confirm', compact("data"));
    }


    public function complete()
    { 

      $data = $request->all(); # 3)
      $request->session()->put($data); # 4)
      Contact::create($request->all());
   
      $data = session()->all();

      Mail::send([ ・・・



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire