title: A ViewModel for a Contact Form in Laravel
body: <p>I am not new to MVC, but I am just getting started with Laravel. In ASP.NET MVC we have ViewModels which is basically a data object that we can pass to the view. The view can then use the ViewModel in whatever way it wishes.</p>
  
  <p>Is there such a thing in Laravel? I want to create a ViewModel that I can pass to my contact view and have it create a form scaffold around it!</p>
  
  <p>What I currently have is:</p>
  
  <p><strong>ROUTE</strong></p>
  
  <pre><code>Route::get('/contact', array('as' =&gt; 'contact', 'uses' =&gt; 'HomeController@contact'));
  
  Route::post('/contact', array('as' =&gt; 'contact', 'uses' =&gt; 'HomeController@postContact'));
  </code></pre>
  
  <p><strong>CONTROLLER</strong></p>
  
  <pre><code>&lt;?php
  
  class HomeController extends BaseController {
  
      public function contact()
      {
          return View::make('contact');
      }
  
      public function postContact()
      {
          $formData = Input::all();
  
          return View::make('contact');
      }
  
  }
  </code></pre>
  
  <p>Also, do you foresee anything wrong with my routes and controller code? In ASP.NET MVC we can have a route with exact same name as long as the verbs are different (POST / GET).</p>
  
  <p>My contact form has 3 textfields (name, email and subject) and one textarea (message).</p>