title: Can't prevent users going back to the admin page after logging out - Laravel 4
body: <p>I'm facing a weird issue while developing a very basic application using Laravel 4. I have created the functionality following the documentation of laravel 4's user authenticating docs where users can sign up to ask different questions and only the registered users can access to the secret/admin page. Everything works well so far except that I'm getting this weird issue where even after logging out users can still access to the precious page or in other word the admin page. I'm not sure it has something to do with Laravel but still I couldn't figure out what's the issue and how to prevent or force the browser to reload or something so that they can't see the admin page even if they click on the back arrow in browser.
  Although it may not be relavent but I'm still attaching the codes I have. In routes.php I have this </p>
  
  <pre><code>&lt;?php
  
  Route::get('/', array('as'=&gt;'home', 'uses'=&gt;'QuestionController@getindex'));
  Route::get('register', array('as'=&gt;'register', 'uses'=&gt;'UserController@getnew'));
  Route::get('login', array('as'=&gt;'login', 'uses'=&gt;'UserController@getlogin'));
  Route::get('logout', array('as'=&gt;'logout', 'uses'=&gt;'UserController@getlogout'));
  
  Route::post('register', array('before'=&gt;'csrf', 'uses'=&gt;'UserController@postcreate'));
  Route::post('login', array('before'=&gt;'csrf', 'uses'=&gt;'UserController@postlogin'));
  </code></pre>
  
  <p>And in userController I have this </p>
  
  <pre><code>&lt;?php
  
  class UserController extends BaseController {
  
      public function getNew() {
  
          return View::make('users.new')
              -&gt;with('title', 'Snappy Q&amp;A - Register');
      }
  
      public function postCreate() {
  
          $validator = Member::validate(Input::all());
  
          if ( $validator-&gt;passes() ) {
              $user = User::create( array (
                  'username' =&gt; Input::get('username'),
                  'password' =&gt; Hash::make(Input::get('password'))
              ));
  
              Auth::login($user);
  
              return Redirect::route('home')-&gt;with('message', 'Thanks for registering!');
          } else {
  
              return Redirect::route('register')-&gt;withErrors($validator)-&gt;withInput();
          }
      }
  
      public function getLogin() {
  
          return View::make('users.login')
              -&gt;with('title', 'Snappy Q&amp;A - Login');
      }
  
      public function postLogin() {
  
          $user_creds = array(
              'username' =&gt; Input::get('username'),
              'password' =&gt; Input::get('password')
          );
  
          if( Auth::attempt($user_creds) ) {
  
              return Redirect::route('home')
                  -&gt;with('message', 'Yep, you are now logged in');
          } else {
  
              return Redirect::route('login')
                  -&gt;with('message', 'Shit man! The creds are not authorised!')
                  -&gt;withInput();
          }
      }
  
      public function getLogout() {
  
          if( Auth::check() ) {
  
              Auth::logout();
              return Redirect::route('login')
                  -&gt;with('message', 'You are now logged out!');
          } else {
  
              return Redirect::route('home');
          }
      }
  
  }
  </code></pre>
  
  <p>This new.blade.php is responsible for creating a new user </p>
  
  <pre><code>@extends('master.master')
  
  @section('content')
  
      @if( $errors-&gt;has() )
          &lt;p&gt;The following erros has occured: &lt;/p&gt;
  
          &lt;ul class="form-errors"&gt;
              {{ $errors-&gt;first('username', '&lt;li&gt;:message&lt;/li&gt;') }}
              {{ $errors-&gt;first('password', '&lt;li&gt;:message&lt;/li&gt;') }}
              {{ $errors-&gt;first('password_confirmation', '&lt;li&gt;:message&lt;/li&gt;') }}
          &lt;/ul&gt;
      @endif
  
      {{ Form::open( array('route'=&gt;'register', 'method'=&gt;'post')) }}
  
          {{ Form::token() }}
  
          {{ Form::label('username', 'Username') }}
          {{ Form::text('username', Input::old('username')) }}
  
          {{ Form::label('password', 'Password') }}
          {{ Form::password('password') }}
  
          {{ Form::label('password_confirmation', 'Confirm Password') }}
          {{ Form::password('password_confirmation') }}
  
          {{ Form::submit('Register', array('class'=&gt;'btn btn-success')) }}
  
      {{ Form::close() }}
  @stop
  </code></pre>
  
  <p>This one is for logging in a user:</p>
  
  <pre><code>@extends('master.master')
  
  @section('content')
  
      {{ Form::open( array('route'=&gt;'login', 'method'=&gt;'post') ) }}
  
          {{ Form::token() }}
  
          {{ Form::label('username', 'Username') }}
          {{ Form::text('username', Input::old('username')) }}
  
          {{ Form::label('password', 'Password') }}
          {{ Form::password('password') }}
  
          {{ Form::submit('Login', array('class' =&gt; 'btn btn-success')) }}
  
      {{ Form::close() }}
  
  @stop
  </code></pre>
  
  <p>TO make it clear, I don't have anything special yet for the admin page except the condition in the navigation with the method Auth::check(); to make sure that only logged in user can see the logout navigation. I will create the functionality later after I'm done with this problem. The admin page view will be in a folder called questions. I hope this makes sense now.</p>
  
  <p>How do I take care of that? Please ask if you still need any other instance of my code. And I believe many of the newbies in Laravel world face more or less the same issue while developing functionality like that. I'm hoping this is a good question and will help others as well as me.</p>