Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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();
```

Expand All @@ -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();
```

Expand Down
6 changes: 3 additions & 3 deletions src/DeviceCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
2 changes: 1 addition & 1 deletion src/Listeners/SaveUserDevice.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down