File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,12 @@ public function tasks()
5555 */
5656 protected static $ baseUrl = 'https://graph.microsoft.com/v1.0/ ' ;
5757
58+ /**
59+ * Set the User model
60+ * @var string
61+ */
62+ protected static $ userModel ;
63+
5864 /**
5965 * @throws Exception
6066 */
@@ -69,6 +75,16 @@ public function setApiVersion($version = '1.0'): static
6975 return $ this ;
7076 }
7177
78+ /**
79+ * @return static
80+ */
81+ public static function setUserModel ($ model ): static
82+ {
83+ self ::$ userModel = $ model ;
84+
85+ return new static ();
86+ }
87+
7288 /**
7389 * Make a connection or return a token where it's valid.
7490 * @return mixed
@@ -84,7 +100,7 @@ public function connect($id = null)
84100
85101 if ($ token !== null ) {
86102 if ($ token ->expires < time ()) {
87- $ user = config ('auth.providers.users.model ' )::find ($ id );
103+ $ user = ( self :: $ userModel ?: config ('auth.providers.users.model ' ) )::find ($ id );
88104 $ this ->renewExpiringToken ($ token , $ id , $ user ->email );
89105 }
90106 }
@@ -173,7 +189,7 @@ public function getAccessToken($id = null, $redirectWhenNotConnected = true)
173189 }
174190
175191 if ($ token ->expires < time () + 300 ) {
176- $ user = config ('auth.providers.users.model ' )::find ($ id );
192+ $ user = ( self :: $ userModel ?: config ('auth.providers.users.model ' ) )::find ($ id );
177193 return $ this ->renewExpiringToken ($ token , $ id , $ user ->email );
178194 }
179195
You can’t perform that action at this time.
0 commit comments