tapp/filament-authentication-log
Install the Package
composer require tapp/filament-authentication-log
Publish Config & Migrations
php artisan vendor:publish --provider="Tapp\FilamentAuthenticationLog\FilamentAuthenticationLogServiceProvider"
php artisan migrate
Configure Laravel Authentication Log Follow rappasoft/laravel-authentication-log to:
AuthenticationLoggable and Notifiable traits to your User model.Register the Plugin
Add to app/Providers/Filament/AdminPanelProvider.php:
public function panel(Panel $panel): Panel
{
return $panel
->plugins([
\Tapp\FilamentAuthenticationLog\FilamentAuthenticationLogPlugin::make(),
]);
}
First Use Case Access the Authentication Logs plugin via the Filament admin panel sidebar. View, filter, and export login attempts (successful/failed) for all users.
Monitoring Logins
user_id, status, or created_at via Filament’s built-in search/filter UI.User-Specific Logs
User resource:
use Tapp\FilamentAuthenticationLog\Resources\AuthenticationLogRelationManager;
public static function getRelations(): array
{
return [
AuthenticationLogRelationManager::make(),
];
}
Exporting Data
->actions([
Tables\Actions\ExportAction::make(),
])
Customizing Logs
AuthenticationLog model or override the Filament resource:
use Tapp\FilamentAuthenticationLog\Resources\AuthenticationLogResource;
class CustomAuthenticationLogResource extends AuthenticationLogResource
{
public static function form(Form $form): Form
{
return parent::form($form)
->columns(2)
->schema([
// Add custom fields (e.g., from laravel-authentication-log)
]);
}
}
Notifying Admins
laravel-authentication-log's Notifiable trait to trigger alerts (e.g., failed logins):
// In User model
public function sendFailedLoginNotification()
{
$this->notify(new FailedLoginNotification());
}
Missing Dependencies
rappasoft/laravel-authentication-log will break the plugin. Verify with:
composer require rappasoft/laravel-authentication-log
Migration Conflicts
laravel-authentication-log migrations were run separately, republish its migrations to avoid table conflicts:
php artisan vendor:publish --tag="authentication-log-migrations"
Permission Issues
AdminPanelProvider:
->middleware([
'auth',
'verified',
'can:access-authentication-logs', // Custom gate
])
Relation Manager Not Showing
User resource, verify:
AuthenticationLog model’s user() relation is correctly defined.getRelations().Timezone Mismatches
authentication_log table’s created_at uses a different timezone. Set in config/authentication-log.php:
'timezone' => 'UTC',
php artisan authentication-log:list to verify raw log data.php artisan optimize:clear
php artisan cache:clear
php artisan tinker
>> \App\Models\User::first()->authenticationLogs()->count();
Custom Columns Override the resource’s table columns:
public static function table(Table $table): Table
{
return parent::table($table)
->columns([
Tables\Columns\TextColumn::make('ip_address')
->label('IP Address'),
// Add more...
]);
}
Webhook Triggers
Hook into authentication.logged or authentication.failed events (from laravel-authentication-log) to sync with external systems:
// In EventServiceProvider
protected $listen = [
'authentication.logged' => [
\App\Listeners\LogLoginToExternalSystem::class,
],
];
Bulk Actions Add custom bulk actions (e.g., "Block User After X Failed Attempts"):
->actions([
Tables\Actions\BulkAction::make('blockUser')
->action(function (Collection $records) {
// Logic to block users
}),
])
How can I help you explore Laravel packages today?