add event types and ip detection

This commit is contained in:
2024-02-05 21:35:41 +05:00
parent a44f20cce1
commit 9639d80704
9 changed files with 478 additions and 9 deletions

View File

@@ -54,7 +54,7 @@ class EventType
return [
'Illuminate\\Auth\\Events\\Attempting' => self::ATTEMPTING,
'Illuminate\\Auth\\Events\\Failed' => self::FAILED,
'Illuminate\Auth\Events\Lockout' => self::LOCKOUT,
'Illuminate\\Auth\\Events\\Lockout' => self::LOCKOUT,
];
}
@@ -87,4 +87,22 @@ class EventType
return self::laravelDefaultEvents()[$event] ?? '';
}
/**
* Log type
*/
public static function logType(string $name): string
{
return match ($name) {
self::REGISTER => 'notice',
self::LOGIN => 'notice',
self::PHONE_VERIFICATION => 'info',
self::LOGOUT => 'notice',
self::PASSWORD_RESET => 'info',
self::FAILED => 'warning',
self::ATTEMPTING => 'info',
self::LOCKOUT => 'alert',
default => 'info',
};
}
}