add event types and ip detection

This commit is contained in:
nurmuhammet committed 2024-02-05 21:35:41 +05:00
1 parent a44f20cce1
commit 9639d80704
9 files changed
+478 -9

No files matched your search

+19 -1
View File
@@ -54,7 +54,7 @@ public static function laravelDefaultEvents(): array
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 @@ public static function guessEvent(string|object $event): string
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',
};
}
}