title: Laravel: Sentry won't check if user is logged in
body: <p>While using the Sentry bundle, I created the <code>LoginController</code> controller to check if a user is logged in where they are redirected in case they're not. My intention is to extend all my restricted pages to this class to make my code more efficient. But why won't it work?</p>
  
  <p>Login controller:</p>
  
  <p>
  
  <pre><code>// Extends the BaseController
  class LoginController extends BaseController {
  
      public function __construct() {
          if(!Sentry::check()) return Redirect::to('login');
      }
  
  }
  </code></pre>
  
  <p>My actual controller:</p>
  
  <pre><code>class MainController extends LoginController {
  
      public function getIndex() {
  
          if(Sentry::getUser()-&gt;hasAccess('view dashboard')) {
              return View::make('admin.index');
          } else {
              return 'You have no access!';
          }
      }
  
  }
  </code></pre>
  
  <p>The error I always get:</p>
  
  <pre><code>Call to a member function hasAccess() on a non-object
  </code></pre>
  
  <p><strong>What works:</strong> If I add <code>if(!Sentry::check()) return Redirect::to('login');</code> directly in <code>getIndex()</code> instead of <code>__construct</code>, the redirection works fine. Why?</p>