title: Using the Remember me feature with Sentry in Laravel 4
body: <p>I'm trying to get  a login form to 'remember' the user logging in and I just can't work out how to do it.</p>
  
  <p>Here's my controller</p>
  
  <pre><code>public function getLogin()
  {
      // Return the view with the data
      return View::make('users.login');
  }
  
  public function postLogin() 
  {
      // Gather Sanitized Input
      $input = array(
          'email'      =&gt; Binput::get('email'),
          'password'   =&gt; Binput::get('password'),
          'rememberMe' =&gt; Binput::get('rememberMe')
          );
  
      // Set Validation Rules
      $rules = array (
          'email'    =&gt; 'required|min:4|max:64|email',
          'password' =&gt; 'required|min:6'
          );
  
      //Run input validation
      $v = Validator::make($input, $rules);
  
      if ($v-&gt;fails())
      {
          // Validation has failed
          return Redirect::to('users/login')-&gt;withErrors($v)-&gt;withInput();
      }
      else 
      {
          try
          {
              //Check for suspension or banned status
              $user = Sentry::getUserProvider()-&gt;findByLogin($input['email']);
              $throttle = Sentry::getThrottleProvider()-&gt;findByUserId($user-&gt;id);
              $throttle-&gt;check();
  
              // Set login credentials
              $credentials = array(
                  'email'    =&gt; $input['email'],
                  'password' =&gt; $input['password']
              );
  
              // Try to authenticate the user
              $user = Sentry::authenticate($credentials, $input['rememberMe']);
              Sentry::loginAndRemember($user);
  
          }
          catch (Cartalyst\Sentry\Users\UserNotFoundException $e)
          {
              // Sometimes a user is found, however hashed credentials do
              // not match. Therefore a user technically doesn't exist
              // by those credentials. Check the error message returned
              // for more information.
              Session::flash('error', 'Invalid username or password.' );
              return Redirect::to('users/login')-&gt;withErrors($v)-&gt;withInput();
          }
          catch (Cartalyst\Sentry\Users\UserNotActivatedException $e)
          {
              echo 'User not activated.';
              Session::flash('error', 'You have not yet activated this account.');
              return Redirect::to('users/login')-&gt;withErrors($v)-&gt;withInput();
          }
  
          // The following is only required if throttle is enabled
          catch (Cartalyst\Sentry\Throttling\UserSuspendedException $e)
          {
              $time = $throttle-&gt;getSuspensionTime();
              Session::flash('error', "Your account has been suspended for $time minutes.");
              return Redirect::to('users/login')-&gt;withErrors($v)-&gt;withInput();
          }
          catch (Cartalyst\Sentry\Throttling\UserBannedException $e)
          {
              Session::flash('error', 'You have been banned.');
              return Redirect::to('users/login')-&gt;withErrors($v)-&gt;withInput();
          }
  
          return Redirect::to('/');
      }
  }
  
  /**
   * Logout
   */
  
  public function getLogout() 
  {
      Session::flush();
      Sentry::logout();
      return Redirect::to('/');
  }
  </code></pre>
  
  <p>And here's my View</p>
  
  <pre><code>@extends('layouts/master')
  
  {{-- Web site Title --}}
  @section('title')
  
  @stop
  
  {{-- Content --}}
  @section('content')
  &lt;div class="tck-well span6 offset3"&gt;
      &lt;h1&gt;Login&lt;/h1&gt;
      &lt;form class="" action="{{ URL::to('users/login') }}" method="post"&gt;   
          {{ Form::token(); }}
  
          &lt;div class="control-group {{ ($errors-&gt;has('email')) ? 'error' : '' }}" for="email"&gt;
              &lt;label class="control-label" for="email"&gt;E-mail&lt;/label&gt;
              &lt;div class="controls"&gt;
                  &lt;input name="email" id="email" value="{{ Request::old('email') }}" type="text" class="input-xlarge" placeholder="E-mail"&gt;
                  {{ ($errors-&gt;has('email') ? $errors-&gt;first('email') : '') }}
              &lt;/div&gt;
          &lt;/div&gt;
  
         &lt;div class="control-group {{ $errors-&gt;has('password') ? 'error' : '' }}" for="password"&gt;
              &lt;label class="control-label" for="password"&gt;Password&lt;/label&gt;
              &lt;div class="controls"&gt;
                  &lt;input name="password" value="" type="password" class="input-xlarge" placeholder="New Password"&gt;
                  {{ ($errors-&gt;has('password') ?  $errors-&gt;first('password') : '') }}
              &lt;/div&gt;
          &lt;/div&gt;
  
          &lt;div class="control-group" for"rememberme"&gt;
              &lt;div class="controls"&gt;
                  &lt;label class="checkbox inline"&gt;
                      &lt;input type="checkbox" name="rememberMe" value="1"&gt; Remember Me
                  &lt;/label&gt;
              &lt;/div&gt;
          &lt;/div&gt;
  
          &lt;div class="form-actions"&gt;
              &lt;input class="button button-large button-secondary" type="submit" value="Log In"&gt; 
              &lt;a href="/users/resetpassword" class="btn btn-link"&gt;Forgot Password?&lt;/a&gt;
          &lt;/div&gt;
    &lt;/form&gt;
  &lt;/div&gt;
  
  @stop
  </code></pre>
  
  <p>Can someone help point me in the right direction please?</p>