rappasoft/laravel-authentication-log
Version 6.x introduces new features that require additional database columns. This guide will help you upgrade your existing installation safely.
composer update rappasoft/laravel-authentication-log
php artisan vendor:publish --provider="Rappasoft\LaravelAuthenticationLog\LaravelAuthenticationLogServiceProvider" --tag="authentication-log-migrations"
This will publish both:
*_add_new_features_to_authentication_log_table.php)php artisan migrate
The upgrade migration will:
The following columns will be added to your authentication_log table:
| Column | Type | Default | Description |
|---|---|---|---|
device_id |
string (nullable, indexed) | null |
Unique device fingerprint |
device_name |
string (nullable) | null |
Human-readable device name |
is_trusted |
boolean | false |
Whether the device is trusted |
last_activity_at |
timestamp (nullable) | null |
Last activity timestamp |
is_suspicious |
boolean | false |
Suspicious activity flag |
suspicious_reason |
string (nullable) | null |
Reason for suspicious flag |
Version 6.x requires Laravel 11.x or 12.x.
If you're still using Laravel 10.x, please continue using version 5.x of this package. Version 6.x is a major release that drops support for Laravel 10.x to simplify the codebase and take advantage of Laravel 11+ features.
null values for new columns (this is safe and expected)If you need to rollback the upgrade migration:
php artisan migrate:rollback --step=1
⚠️ Warning: This will remove the new columns and delete any data stored in them.
This shouldn't happen as the migration checks for column existence. If it does:
Check which columns already exist:
php artisan tinker
>>> Schema::hasColumn('authentication_log', 'device_id')
If columns already exist, you can skip the migration or manually remove the checks.
This is expected behavior. Only new authentication logs created after the upgrade will have device fingerprints. Existing logs will have null values, which is safe.
Check Laravel version:
php artisan --version
New features require Laravel 11.x or 12.x.
Verify migrations ran successfully:
php artisan migrate:status
Clear config cache:
php artisan config:clear
Check that columns exist:
php artisan tinker
>>> Schema::hasColumn('authentication_log', 'device_id')
>>> Schema::hasColumn('authentication_log', 'is_suspicious')
Check if the table exists:
php artisan tinker
>>> Schema::hasTable('authentication_log')
Check the migration file was published correctly:
ls -la database/migrations/*add_new_features*
Check migration logs:
php artisan migrate:status
After upgrading, verify everything works:
// In tinker or a test route
$user = User::first();
// Basic functionality (works on all Laravel versions)
$user->authentications()->count();
$user->lastLoginAt();
// New features (Laravel 11+ only)
if (\Rappasoft\LaravelAuthenticationLog\Helpers\LaravelVersion::supportsNewFeatures()) {
$user->getLoginStats();
$user->getDevices();
$user->getActiveSessions();
}
If you encounter any issues during the upgrade:
After upgrading:
How can I help you explore Laravel packages today?