From f6ccb9bfd702ca788c1b770c3ce402e90474ba50 Mon Sep 17 00:00:00 2001 From: Ollie Read Date: Tue, 14 Jan 2014 19:23:47 +0000 Subject: [PATCH] Added a get() function to wrap around for Auth::user(), to be used like Auth::type()->get(). Also added an impersonate function for logged in users, to be used like Auth::admin()->impersonate('user', 1, true) --- src/Ollieread/Multiauth/Guard.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Ollieread/Multiauth/Guard.php b/src/Ollieread/Multiauth/Guard.php index 9932542..a31edbc 100644 --- a/src/Ollieread/Multiauth/Guard.php +++ b/src/Ollieread/Multiauth/Guard.php @@ -22,4 +22,14 @@ public function getRecallerName() { return 'remember_' . $this->name . '_' . md5(get_class($this)); } + public function get() { + return $this->user(); + } + + public function impersonate($type, $id, $remember = false) { + if($this->check()) { + return Auth::$type()->loginUsingId($id, $remember); + } + } + }