File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1010use Illuminate \Database \Eloquent \Relations \HasOne ;
1111use Illuminate \Foundation \Auth \User as Authenticatable ;
1212use Illuminate \Notifications \Notifiable ;
13+ use Illuminate \Support \Facades \Hash ;
14+ use Laravel \Passport \Bridge \Client ;
1315use Laravel \Passport \Contracts \OAuthenticatable ;
1416use Laravel \Passport \HasApiTokens ;
1517
@@ -284,6 +286,18 @@ public function getOrCreateDataSettings(): UserDataSettings
284286 ]);
285287 }
286288
289+ public function findForPassport (string $ username , Client $ client ): User
290+ {
291+ return $ this ->where ('email ' , $ username )
292+ ->where ('status ' , '= ' , 1 )
293+ ->first ();
294+ }
295+
296+ public function validateForPassportPasswordGrant (string $ password ): bool
297+ {
298+ return $ this ->status == 1 && Hash::check ($ password , $ this ->password );
299+ }
300+
287301 public function getTotalWatchTimeInHours (): int
288302 {
289303 return (int ) ($ this ->videoViews ()->sum ('watch_time_seconds ' ) / 3600 );
You can’t perform that action at this time.
0 commit comments