add lockout, failed and attemting events
This commit is contained in:
@@ -5,22 +5,67 @@ namespace App\Events;
|
||||
class EventType
|
||||
{
|
||||
/**
|
||||
* When user logs in application
|
||||
* When user registers to application
|
||||
*/
|
||||
public const REGISTER = 'REGISTER';
|
||||
|
||||
/**
|
||||
* When user logs in application
|
||||
* When user logs into application
|
||||
*/
|
||||
public const LOGIN = 'LOGIN';
|
||||
|
||||
/**
|
||||
* When user logs in application
|
||||
* When user verifies phone number
|
||||
*/
|
||||
public const PHONE_VERIFICATION = 'PHONE_VERIFICATION';
|
||||
|
||||
/**
|
||||
* When user logs out of application
|
||||
*/
|
||||
public const LOGOUT = 'LOGOUT';
|
||||
|
||||
/**
|
||||
* When user logs in application
|
||||
* When user resets password
|
||||
*/
|
||||
public const PASSWORD_RESET = 'PASSWORD_RESET';
|
||||
|
||||
/**
|
||||
* When user resets password
|
||||
*/
|
||||
public const FAILED = 'FAILED';
|
||||
|
||||
/**
|
||||
* When user resets password
|
||||
*/
|
||||
public const ATTEMPTING = 'ATTEMPTING';
|
||||
|
||||
/**
|
||||
* When user resets password
|
||||
*/
|
||||
public const LOCKOUT = 'LOCKOUT';
|
||||
|
||||
/**
|
||||
* Laravel's default events
|
||||
*/
|
||||
public static function laravelDefaultEvents(): array
|
||||
{
|
||||
return [
|
||||
'Illuminate\\Auth\\Events\\Attempting' => self::ATTEMPTING,
|
||||
'Illuminate\\Auth\\Events\\Failed' => self::FAILED,
|
||||
'Illuminate\Auth\Events\Lockout' => self::LOCKOUT,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Guest the event
|
||||
* @param object $event
|
||||
*/
|
||||
public static function guessEvent(string|object $event): string
|
||||
{
|
||||
if (is_object($event)) {
|
||||
$event = get_class($event);
|
||||
}
|
||||
|
||||
return self::laravelDefaultEvents()[$event] ?? '';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user