Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Authentication Log Laravel Package

rappasoft/laravel-authentication-log

View on GitHub
Deep Wiki
Context7

title: Device Management weight: 4

The package uses device fingerprinting to reliably identify and manage user devices. Each device is assigned a unique fingerprint based on browser characteristics, IP address, and other factors.

Device Fingerprinting

Device fingerprinting uses SHA-256 hashing to create a unique identifier for each device. This is more reliable than using just IP address and user agent, as it accounts for multiple factors.

How It Works

When a user logs in, the package automatically:

  1. Generates a device fingerprint using browser characteristics
  2. Creates a friendly device name (e.g., "Chrome on Windows")
  3. Checks if the device has been seen before
  4. Stores the device information with the authentication log

Getting User Devices

Get all devices that have been used by a user:

$user = User::find(1);
$devices = $user->getDevices();

// Returns a collection with:
// - device_id
// - device_name
// - ip_address
// - user_agent
// - is_trusted
// - login_at (most recent)

Trusting Devices

Mark a device as trusted to allow it access to sensitive actions:

$user = User::find(1);
$deviceId = 'abc123...'; // Device fingerprint

// Trust a device
$user->trustDevice($deviceId);

// Check if device is trusted
if ($user->isDeviceTrusted($deviceId)) {
    // Device is trusted
}

Untrusting Devices

Remove trust from a device:

$user = User::find(1);
$deviceId = 'abc123...';

$user->untrustDevice($deviceId);

Updating Device Names

Allow users to customize device names for easier identification:

$user = User::find(1);
$deviceId = 'abc123...';

$user->updateDeviceName($deviceId, 'My Work Laptop');

Example: Device Management UI

// In your controller
public function devices()
{
    $user = auth()->user();
    $devices = $user->getDevices();
    
    return view('profile.devices', compact('devices'));
}

// In your view
[@foreach](https://github.com/foreach)($devices as $device)
    <div class="device-item">
        <div>
            <strong>{{ $device->device_name }}</strong>
            [@if](https://github.com/if)($device->is_trusted)
                <span class="badge badge-success">Trusted</span>
            [@endif](https://github.com/endif)
        </div>
        <div>
            Last used: {{ $device->login_at->diffForHumans() }}
        </div>
        <div>
            <form action="{{ route('devices.trust', $device->device_id) }}" method="POST">
                [@csrf](https://github.com/csrf)
                [@if](https://github.com/if)($device->is_trusted)
                    <button type="submit" name="action" value="untrust">Untrust Device</button>
                [@else](https://github.com/else)
                    <button type="submit" name="action" value="trust">Trust Device</button>
                [@endif](https://github.com/endif)
            </form>
        </div>
    </div>
[@endforeach](https://github.com/endforeach)

Getting Current Device ID

To get the current device's fingerprint:

use Rappasoft\LaravelAuthenticationLog\Helpers\DeviceFingerprint;

$currentDeviceId = DeviceFingerprint::generate(request());
$deviceName = DeviceFingerprint::generateDeviceName(request());
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope