mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-08-19 09:51:35 +02:00
Add User & AuthLog equals() method for comparison during tests
This commit is contained in:
@@ -89,4 +89,19 @@ class AuthLog extends Model
|
|||||||
{
|
{
|
||||||
return $this->morphTo();
|
return $this->morphTo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compare 2 Authentications
|
||||||
|
*/
|
||||||
|
public function equals(self $other) : bool
|
||||||
|
{
|
||||||
|
return $this->ip_address === $other->ip_address &&
|
||||||
|
$this->user_agent === $other->user_agent &&
|
||||||
|
$this->login_at == $other->login_at &&
|
||||||
|
$this->login_successful == $other->login_successful &&
|
||||||
|
$this->logout_at == $other->logout_at &&
|
||||||
|
$this->cleared_by_user == $other->cleared_by_user &&
|
||||||
|
$this->guard == $other->guard &&
|
||||||
|
$this->login_method == $other->login_method;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -232,4 +232,16 @@ class User extends Authenticatable implements HasLocalePreference, WebAuthnAuthe
|
|||||||
{
|
{
|
||||||
return $this->hasMany(\App\Models\Group::class);
|
return $this->hasMany(\App\Models\Group::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compare 2 Users
|
||||||
|
*/
|
||||||
|
public function equals(self $other) : bool
|
||||||
|
{
|
||||||
|
return $this->name === $other->name &&
|
||||||
|
$this->email === $other->email &&
|
||||||
|
$this->oauth_id == $other->oauth_id &&
|
||||||
|
$this->oauth_provider == $other->oauth_provider;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user