Skip to content

Instantly share code, notes, and snippets.

@ollieread
Last active January 4, 2016 01:19
Show Gist options
  • Save ollieread/8547632 to your computer and use it in GitHub Desktop.
Save ollieread/8547632 to your computer and use it in GitHub Desktop.
<?php
// original
return array(
'driver' => 'eloquent',
'model' => 'User',
'table' => 'users',
'reminder' => array(
'email' => 'emails.auth.reminder',
'table' => 'password_reminders',
'expire' => 60,
),
);
// new
return array(
'multi' => array(
'account' => array(
'driver' => 'eloquent',
'model' => 'Account'
),
'user' => array(
'driver' => 'database',
'table' => 'users'
)
),
'reminder' => array(
'email' => 'emails.auth.reminder',
'table' => 'password_reminders',
'expire' => 60,
),
);
"require": {
"ollieread/multiauth": "dev-master"
}
<?php
Auth::account()->attempt(array(
'email' => $attributes['email'],
'password' => $attributes['password'],
));
Auth::user()->attempt(array(
'email' => $attributes['email'],
'password' => $attributes['password'],
));
Auth::account()->check();
Auth::user()->check();
// This is an extra method I added in, to avoid having to do things like Auth::user()->user()
Auth::user()->get();
// This is a cool little method to sign in as another user type, while signed in via a different one
Auth::admin()->impersonate('user', 1, true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment