diff --git a/README.md b/README.md index a1cc357..4e762f7 100644 --- a/README.md +++ b/README.md @@ -126,12 +126,12 @@ class User extends Authenticatable The package automatically saves user devices when the `Authenticated` event is fired (on every authenticated request). No manual setup required—just add the `HasUserDevices` trait to your User model. -To skip saving the device entirely for a request (e.g. in middleware or controller before authentication): +To skip saving the device entirely for a request (e.g. in middleware or controller before authentication, or before impersonation such as `onceUsingId`): ```php use UserDevices\DeviceCreator; -// In middleware or controller—call before the user is authenticated +// Call before the user is authenticated for this request DeviceCreator::ignoreListener(); ``` @@ -140,7 +140,7 @@ To ignore only the new login notification (device is still saved, but no email i ```php use UserDevices\DeviceCreator; -// In middleware or controller—call before the user is authenticated +// Call before the user is authenticated for this request DeviceCreator::ignoreNotification(); ``` diff --git a/src/DeviceCreator.php b/src/DeviceCreator.php index 11a9b5f..7ef48cb 100644 --- a/src/DeviceCreator.php +++ b/src/DeviceCreator.php @@ -42,10 +42,10 @@ class DeviceCreator public static string $userDeviceModel = UserDevice::class; /** - * Add a flag to the request context so the new login device listener is skipped. + * Add a flag to the request context so the device listener is skipped for this request. * - * Call this before authentication (e.g. in middleware or controller) when you - * want to skip saving the device for this request. + * Call before authentication (e.g. in middleware or before impersonation with + * onceUsingId) when you do not want to create or update a device for this request. */ public static function ignoreListener(): void { diff --git a/src/Listeners/SaveUserDevice.php b/src/Listeners/SaveUserDevice.php index 516f653..49d1021 100644 --- a/src/Listeners/SaveUserDevice.php +++ b/src/Listeners/SaveUserDevice.php @@ -13,7 +13,7 @@ class SaveUserDevice { /** - * Handle the event. + * Handle the event. Skips when DeviceCreator::ignoreListener() was called for the current request. */ public function handle(Authenticated $event): void {