Search code examples
phplaravellaravel-4cartalyst-sentry

Laravel 4: Auth credentials with two optional value to user type


I have 3 types of users:

  1. Client
  2. Admin
  3. Super Admin

Now, I need to allow both admin and super admin to login in my admin portal how ever to implement the authentication we are going to put in array form our credentials like:

$creds = array('username'=>Input::get('uname'),'password'=>Input::get('pwd'),'usertype'=>$utype);

How can I allow both admin and super admin in Auth if I am only allowed to declare usertype once in my $creds array?


Solution

  • Apply some groups to your users, add the user to a group and validate on that. ( Or even, apply ACL to groups, and check on that ) Is the future requires more types of users you can just add them to a group instead of altering your $creds array.