title: Laravel 5.1 multiple authentication
body: <p>How can you authenticate multiple types of users in Laravel 5.1 e.g. Jobseeker, Recruiter, Admin etc. </p>
  
  <p>Some of you have suggested using a single users table to store only the password and email, creating profile tables to store user specific information (jobseeker_profile, recruiter_profile) and using roles to differentiate between the different types of users (i.e having a roles and role_user) table. </p>
  
  <p>This is all very well but then what if the different types of users have different registration and login forms. How do you customize the default auth controller out of the box to display the correct view?</p>
  
  <p>So if I have the following routes:</p>
  
  <pre><code>// Jobseeker Authentication routes...
  Route::get('auth/login', 'Auth\AuthController@getLogin');
  Route::post('auth/login', 'Auth\AuthController@postLogin');
  Route::get('auth/logout', 'Auth\AuthController@getLogout');
  
  // Jobseeker Registration routes...
  Route::get('auth/register', 'Auth\AuthController@getRegister');
  Route::post('auth/register', 'Auth\AuthController@postRegister');
  
  
  // Recruiter Authentication routes...
  Route::get('recruiter/auth/login', 'Auth\AuthController@getLogin');
  Route::post('recruiter/auth/login', 'Auth\AuthController@postLogin');
  Route::get('recruiter/auth/logout', 'Auth\AuthController@getLogout');
  
  // Recruiter Registration routes...
  Route::get('recruiter/auth/register', 'Auth\AuthController@getRegister');
  Route::post('recruiter/auth/register', 'Auth\AuthController@postRegister');
  </code></pre>
  
  <p>This is the default auth controller out of the box:</p>
  
  <pre><code>class AuthController extends Controller
  {
      use AuthenticatesAndRegistersUsers;
  
      public function __construct()
      {
          $this-&gt;middleware('guest', ['except' =&gt; 'getLogout']);
      }
  
      protected function validator(array $data)
      {
          return Validator::make($data, [
              'name' =&gt; 'required|max:255',
              'email' =&gt; 'required|email|max:255|unique:users',
              'password' =&gt; 'required|confirmed|min:6',
          ]);
      }
  
      protected function create(array $data)
      {
          return User::create([
              'name' =&gt; $data['name'],
              'email' =&gt; $data['email'],
              'password' =&gt; bcrypt($data['password']),
          ]);
      }
  }    
  </code></pre>
  
  <p>traits used by the default out of the box auth controller:</p>
  
  <pre><code>trait AuthenticatesUsers
  {
     use RedirectsUsers;
  
     public function getLogin()
     {
          return view('auth.login');
      }
  
     public function postLogin(Request $request)
     {
          $this-&gt;validate($request, [
              'email' =&gt; 'required|email', 'password' =&gt; 'required',
          ]);
  
          $credentials = $this-&gt;getCredentials($request);
  
          if (Auth::attempt($credentials, $request-&gt;has('remember'))) {
              return redirect()-&gt;intended($this-&gt;redirectPath());
          }
  
          return redirect($this-&gt;loginPath())
              -&gt;withInput($request-&gt;only('email', 'remember'))
              -&gt;withErrors([
                 'email' =&gt; $this-&gt;getFailedLoginMessage(),
              ]);
     }
  
      public function loginPath()
     {
          return property_exists($this, 'loginPath') ? $this-&gt;loginPath : '/auth/login';
      }
  
  }
  
  trait RegistersUsers
  {
      use RedirectsUsers;
  
      public function getRegister()
      {
          return view('auth.register');
      }
  
      public function postRegister(Request $request)
      {
          $validator = $this-&gt;validator($request-&gt;all());
  
          if ($validator-&gt;fails()) {
              $this-&gt;throwValidationException(
                  $request, $validator
              );
           }
  
           Auth::login($this-&gt;create($request-&gt;all()));
  
          return redirect($this-&gt;redirectPath());
      }
  }
  </code></pre>
  
  <p>I'm sure this is a very common requirement for many web applications but I can't find any helpful tutorials for Laravel specific implementations. All the tutorial simply focus on the out of the box implementation for some odd reason. </p>
  
  <p>Any help on the above would be much appreciated.</p>