Created
September 16, 2014 21:38
-
-
Save prodeveloper/5f3c34ef4e9b93cef76f to your computer and use it in GitHub Desktop.
sentry_to_native
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Event::listen('sentinel.user.logout',function(){ | |
(new \Listeners\UpdateNativeAuth())->whenUserLogout(); | |
}); | |
Event::listen('sentinel.user.login',function($sentry_user){ | |
$user=User::findOrFail($sentry_user->getId()); | |
(new \Listeners\UpdateNativeAuth())->whenUserLogin(new \Events\SentryUserAction($user)); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* | |
*/ | |
namespace Events; | |
use User; | |
class SentryUserAction { | |
/** | |
* @var \User | |
*/ | |
public $user; | |
function __construct(User $user){ | |
$this->user = $user; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Listeners; | |
use Auth; | |
use Events\SentryUserAction; | |
class UpdateNativeAuth | |
{ | |
function whenUserLogin(SentryUserAction $event) | |
{ | |
Auth::login($event->user); | |
} | |
function whenUserLogout() | |
{ | |
Auth::logout(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment