title: Passing data with login redirect - Laravel 4
body: <p>The scenario is, a user must be logged in to be able to 'book an event'. My ideal process is:</p>
  
  <ol>
  <li>User wishes to attend an event, clicks the attend button.</li>
  <li>Auth filter realises user isn't logged in and so redirects to the login page</li>
  <li>Once user is authenticated, the event ID and user ID is passed to the 'PostCreate' function within the 'Events' controller to book them on.</li>
  </ol>
  
  <p>Currently, the user is redirected if not logged in, to the login page. Once the user is logged in, it attempts to call the 'events/create' controller method which is postCreate, but an error message is presented. </p>
  
  <blockquote>
    <p>Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException
    Controller method not found.</p>
  </blockquote>
  
  <p>However, as I am now authenticated, I can go back to the  event, click attend, and it will process the booking. I am a little stumped as to why this won't work! Any help would be appreciated.</p>
  
  <p>Is it down to the event ID not being passed with the login data? If so, it still should be able to find the controller method?</p>
  
  <p><strong>Event Controller:</strong></p>
  
  <pre><code>&lt;?php
  
  class EventsController extends BaseController {
  
      protected $layout = "layouts.main";
  
      public function __construct(){
          $this-&gt;beforeFilter('csrf', array('on'=&gt;'post'));
          $this-&gt;beforeFilter('auth', array('only'=&gt;array('postCreate')));
      }
  
      /**
       * Show the form for creating a new resource.
       *
       * @return Response
       */
  
      public function postCreate(){
  
          $user_id        = Auth::user()-&gt;id;
          $user           = myApp\User::find($user_id);
          $event_id       = Input::get('event_id');
          $event_name     = myApp\Event::find($event_id)-&gt;title;
  
          $user-&gt;event()-&gt;attach($event_id);
  
          return Redirect::back()-&gt;with('message-success', 'You are now attending '.$event_name.' !');
  
      }
  </code></pre>
  
  <p><strong>Users Controller</strong></p>
  
  <pre><code>public function postSignin(){
      if (Auth::attempt(array('email'=&gt;Input::get('email'), 'password'=&gt;Input::get('password')))) {
  
          $title   = Auth::user()-&gt;title;
          $surname = Auth::user()-&gt;surname;
  
          return Redirect::intended('users/dashboard')-&gt;with('message-success', 'You are now logged in, '.$title.' '.$surname.'. ');
      } else {
          return Redirect::to('users/login')
          -&gt;with('message-danger', 'Your username/password combination was incorrect')
          -&gt;withInput();
      }
  }
  </code></pre>
  
  <p><strong>Show.blade.php</strong></p>
  
  <pre><code>&lt;div class="col-md-3"&gt;
      @if (Auth::user())
      &lt;br&gt;
      @if (!in_array($events-&gt;id, $attending))
      {{ Form::open(array('url'=&gt;'events/create', 'class'=&gt;'form-signup', 'role'=&gt;'form')) }}
      {{ Form::hidden('event_id', $events-&gt;id) }}
      {{ Form::submit('Attend Event', array('class'=&gt;'btn btn-success'))}}
      {{ Form::close() }}
      @else
      {{ Form::open(array('url'=&gt;'events/cancel', 'class'=&gt;'form-cancel', 'role'=&gt;'form')) }}
      {{ Form::hidden('event_id', $events-&gt;id) }}
      {{ Form::submit('Cancel Booking', array('class'=&gt;'btn btn-warning'))}}
      {{ Form::close() }}
      @endif
      @else
      {{ Form::open(array('url'=&gt;'events/create', 'class'=&gt;'form-signup', 'role'=&gt;'form')) }}
      {{ Form::hidden('event_id', $events-&gt;id) }}
      {{ Form::submit('Attend Event', array('class'=&gt;'btn btn-success'))}}
      {{ Form::close() }}
      @endif
  &lt;/div&gt;
  </code></pre>
  
  <p></p>
  
  <p><strong>Routes</strong></p>
  
  <pre><code>/* Event Route */
  Route::get('events/{id}/{slug}', 'EventsController@show');
  Route::controller('events', 'EventsController');
  
  /* User Route */
  Route::controller('users', 'UsersController');
  
  /* Home Route */
  Route::get('/', 'HomeController@getHome');
  Route::controller('/', 'HomeController');
  </code></pre>