|
@@ -116,10 +116,12 @@ class User extends BaseModel
|
|
}
|
|
}
|
|
|
|
|
|
public function latestLogInPin(){
|
|
public function latestLogInPin(){
|
|
- $loginOrSignupAttempt = LoginOrSignupAttempt::whereRaw('email ilike ' . $this->email)
|
|
|
|
- ->where('is_valid', true)->orderBy('created_at', 'desc')->first();
|
|
|
|
- if($loginOrSignupAttempt){
|
|
|
|
- return $loginOrSignupAttempt->pin;
|
|
|
|
|
|
+ if($this->email) {
|
|
|
|
+ $loginOrSignupAttempt = LoginOrSignupAttempt::whereRaw('email', 'ilike', $this->email)
|
|
|
|
+ ->where('is_valid', true)->orderBy('created_at', 'desc')->first();
|
|
|
|
+ if ($loginOrSignupAttempt) {
|
|
|
|
+ return $loginOrSignupAttempt->pin;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
return '';
|
|
return '';
|
|
}
|
|
}
|