title: Submit form and redirect to another view
body: <p>I have 2 simple views: <code>home</code> and <code>create</code>. Here is the controller for them</p>
  
  <pre><code>public function index()
  {
      $products = Product::all();
      return view('home', compact('products'));
  }
  
  public function createProduct() 
  {
      return view('productCreate');
  }
  public function createProductSubmit( Request $request ) {
  
  
      $product = new Product;
  
      $product-&gt;productName = $request-&gt;name;
      $product-&gt;productPrice = $request-&gt;price;
      $product-&gt;quantity = strip_tags($request-&gt;quantity);
      $product-&gt;category_id = $request-&gt;category;
  
      $product-&gt;save();                              
      return view('home');
  }
  </code></pre>
  
  <p>and the routes</p>
  
  <pre><code>Route::get('/home', 'HomeController@index');
  
  Route::get('/home/product/create', 'HomeController@createProduct');
  Route::post('/home/product/create', 'HomeController@createProductSubmit');
  </code></pre>
  
  <p>The problem is that when I go in <code>/home/product/create</code> to create new product and after I add everything and submit the form I've get the error</p>
  
  <blockquote>
    <p>Undefined variable: products in home.blade.php</p>
  </blockquote>
  
  <p>Why I get this error? In my <code>index()</code> function I have passing it?</p>
  
  <p>Update</p>
  
  <pre><code>    &lt;table class="table table-striped"&gt;
        &lt;thead&gt;
          &lt;tr&gt;
            &lt;th&gt;#&lt;/th&gt;
            &lt;th&gt;Product Name&lt;/th&gt;
            &lt;th&gt;Product Price&lt;/th&gt;
            &lt;th&gt;Product Quantity&lt;/th&gt;
            &lt;th&gt;Category&lt;/th&gt;
            &lt;th&gt;Action&lt;/th&gt;
          &lt;/tr&gt;
        &lt;/thead&gt;
        &lt;tbody&gt;
      @foreach( $products as $product )
          &lt;tr&gt;
            &lt;th&gt;{{ $product-&gt;id }}&lt;/th&gt;
            &lt;td&gt;{{ $product-&gt;productName }}&lt;/td&gt;
            &lt;td&gt;{{ $product-&gt;productPrice }}&lt;/td&gt;
            &lt;td&gt;{{ $product-&gt;quantity }}&lt;/td&gt;
            &lt;td&gt;{{ $product-&gt;category_id }}&lt;/td&gt;
            &lt;td&gt;&lt;button class='btn btn-success'&gt;Edit&lt;/button&gt; &lt;button class='btn btn-danger'&gt;Delete&lt;/button&gt;&lt;/td&gt;
          &lt;/tr&gt;
      @endforeach
        &lt;/tbody&gt;
      &lt;/table&gt; 
  </code></pre>