title: how to display form data for preview before submitting in Laravel 5.6
body: <p>My View have a simple form. I want to show this data to user for review before submitting to the database. I am using Laravel 5.6 </p>
  
  <pre><code>&lt;form action="{{url('/posts')}}" method="POST"&gt;
      @csrf
      &lt;div class="form-group"&gt;
        &lt;label for="title"&gt;Title of your Post&lt;/label&gt;
        &lt;input type="text" class="form-control"  placeholder="Post Title Goes here" name="title"&gt;     
      &lt;/div&gt;
      &lt;div class="form-group"&gt;
          &lt;label for="body"&gt;Post Details&lt;/label&gt;
          &lt;textarea class="form-control" id="summernote"  placeholder="Detail of Post Goes here" name="body"&gt;&lt;/textarea&gt;     
        &lt;/div&gt;
      &lt;button type="submit" class="btn btn-primary"&gt;Save&lt;/button&gt;
    &lt;/form&gt;   
  </code></pre>
  
  <p>I also want my user to edit it if he wants to make changes.</p>
  
  <p><strong>Controller:</strong></p>
  
  <pre><code>public function store(Request $request)
      {
          //validate the form
          $this-&gt;validate($request, [
              'title' =&gt; 'required',
              'body' =&gt; 'required'
          ]);
  
          //save data in database
          $data = $request-&gt;all();
          if(!empty ($data)){
              try{
                  $newpost = new Post();
                  $newpost-&gt;title = $data['title'];
                  $newpost-&gt;body = $data['body'];
                  $newpost-&gt;save();
                  return redirect('/posts')-&gt;with('success', 'Record Added Successfuly');
              }catch(\Exception $e){
                 // echo $e;
              }
  
          }//if ends here
  
      } 
  </code></pre>