title: Laravel custom auth filter
body: <p>I've added the standard auth filter to several routes using Route::Intended('/') in the controller (assuming login is successful).</p>
  
  <p>filters.php:</p>
  
  <pre><code>Route::filter('auth', function(){
      if (Auth::guest()) return Redirect::guest('internal/login');
  });
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code>if (Auth::attempt($data, false))
  {
      return Redirect::intended('/');
  }
  </code></pre>
  
  <p>How do I go about creating a custom auth filter that checks for a specific permission (isAdmin in this case)?</p>
  
  <p>I've made the auth.admin filter the same as the standard auth filter to redirect to the login page, but do I need a second Login method on my controller or is there a way to tell which filter (if any) invoked the controller method?</p>
  
  <pre><code>if (Auth::attempt($data, false))
  {
      if (RouteHasAdminFilter())
      {
          if (!Auth::User()-&gt;Admin)
              return Redirect::intended('/');
          else
              return Redirect::to('/');
      }
      else
      {
          return Redirect::intended('/');
      }
  }
  </code></pre>