title: auth::check in laravel 5 not working
body: <p>I am new in laravel 5 and trying to create a simple authentication system where an user can simply registers and logs in, if the user is logged in it would show a welcome message, otherwise the registration and login buttons. But I'm trying to check whether the user is logged in using Auth::check() it's giving me false both in my controller and view though I've successfully logged in using Auth::attempt(). I've searched in SO and other sites, but found no viable solution, somewhere it said it's a bug in laravel 5, somewhere the problem was just something wrong in their code. I don't know what am I doing wrong here.</p>
  
  <p><strong>login.blade.php</strong></p>
  
  <pre><code>@extends('master')
  
      @section('content')
          &lt;h1&gt;বাংলার পথে&lt;/h1&gt;
          @if(Auth::check())
              &lt;p&gt;স্বাগতম {{ $username }}&lt;/p&gt;
          @else
              &lt;a class="tb-button all-around-spacing push-left" href="/login"&gt;লগ ইন&lt;/a&gt;
              &lt;a class="tb-button all-around-spacing push-left" href="/register"&gt;রেজিস্টার&lt;/a&gt;
          @endif
      @stop
  </code></pre>
  
  <p><strong>AuthenticationController.php</strong></p>
  
  <pre><code>public function login() {
      $validator = Validator::make(Input::all(), array(
          'user_email' =&gt; 'required|email',
          'user_password' =&gt; 'required|alphaNum'
      ));
  
      $niceNames = array(
          'user_email' =&gt; 'ই-মেইল',
          'user_password' =&gt; 'পাসওয়ার্ড'
      );
  
      $validator-&gt;setAttributeNames($niceNames);
  
      if($validator-&gt;fails()) {
          return Redirect::to('login')-&gt;withErrors($validator);
      } else {
          $remember = Input::get('remember');
          if(Auth::attempt(array('user_email' =&gt; Input::get('user_email'), 'password' =&gt; Input::get('user_password')), $remember)) {
              return Redirect::to('/');
          } else {
              return Redirect::to('login')-&gt;withMessage('আপনার ই-মেইল অথবা পাসওয়ার্ড টি ভূল');
          }
      }
  }
  
  public function register() {
      $validator = Validator::make(Input::all(), array(
              'user_name' =&gt; 'required|between:6,16',
              'user_email' =&gt; 'required|email|unique:users',
              'user_password' =&gt; 'required|alphaNum|between:6,16|confirmed',
              'user_password_confirmation' =&gt; 'same:user_password'
          )
      );
  
      $niceNames = array(
          'user_name' =&gt; 'ট্রাভেলার নাম',
          'user_email' =&gt; 'ই-মেইল',
          'user_password' =&gt; 'পাসওয়ার্ড',
          'user_password_confirmation' =&gt; 'পাসওয়ার্ড নিশ্চীতকরণ'
      );
  
      $validator-&gt;setAttributeNames($niceNames);
  
      if($validator-&gt;fails()) {
          Input::flash();
          return Redirect::to('register')-&gt;withErrors($validator);
      } else {
          DB::transaction(function(){
              $user = new User();
              $user-&gt;user_name = Input::get('user_name');
              $user-&gt;user_email = Input::get('user_email');
              $user-&gt;password = Hash::make(Input::get('user_password'));
              $user-&gt;save();
          });
  
          return Redirect::to('login');
      }
  }
  </code></pre>
  
  <p><strong>HomeController.php</strong></p>
  
  <pre><code>public function index()
  {
      if(Auth::check()) {
          $username = Auth::user()-&gt;user_name;
          return View::make('home/index')-&gt;withUsername($username);
      } else {
          return View::make('home/index');
      }
  
  }
  </code></pre>
  
  <p><strong>User.php</strong></p>
  
  <pre><code>&lt;?php
  /**
   * Created by PhpStorm.
   * User: Shuvro
   * Date: 6/20/15
   * Time: 12:30 AM
   */
  
  namespace App\models;
  
  
  use Illuminate\Auth\Authenticatable;
  use Illuminate\Database\Eloquent\Model;
  use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
  
  
  class User extends Model implements AuthenticatableContract {
      use Authenticatable;
      protected $table = 'users';
      protected $fillable = ['user_name','user_email','user_password','user_password_confirmation'];
      protected $hidden = ['user_password','remember_token'];
  } 
  </code></pre>
  
  <p><strong>Routes.php</strong></p>
  
  <pre><code>Route::get('/', array('as' =&gt; 'index', 'uses' =&gt; 'HomeController@index'));
  
  Route::get('/register', array('as' =&gt; 'register', 'uses' =&gt; 'AuthenticationController@registerView'));
  Route::post('/register', array('as' =&gt; 'register', 'uses' =&gt; 'AuthenticationController@register'));
  
  Route::get('/login', array('as' =&gt; 'login', 'uses' =&gt; 'AuthenticationController@loginView'));
  Route::post('/login', array('as' =&gt; 'login', 'uses' =&gt; 'AuthenticationController@login'));
  </code></pre>
  
  <p><strong>CreateUserTable</strong></p>
  
  <pre><code>   Schema::create('users', function(Blueprint $table) {
          $table-&gt;increments('user_id');
          $table-&gt;string('user_name');
          $table-&gt;string('user_email')-&gt;unique('user_email');
          $table-&gt;string('password');
          $table-&gt;rememberToken();
          $table-&gt;timestamps();
      });
  </code></pre>