Add User & AuthLog equals() method for comparison during tests

This commit is contained in:
Bubka 2024-07-03 11:09:44 +02:00
parent a23be58ba9
commit 57d78a8675
2 changed files with 27 additions and 0 deletions

View File

@ -89,4 +89,19 @@ public function authenticatable()
{
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;
}
}

View File

@ -232,4 +232,16 @@ public function groups()
{
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;
}
}