spykapps/filament-passwordless-login
Install the package:
composer require spykapps/filament-passwordless-login
This auto-installs spykapps/passwordless-login as a dependency.
Publish migrations and config:
php artisan vendor:publish --tag=passwordless-login-config
php artisan vendor:publish --tag=passwordless-login-migrations
php artisan migrate
Add the trait to your User model:
use SpykApp\PasswordlessLogin\Traits\HasMagicLogin;
class User extends Authenticatable
{
use HasMagicLogin;
}
Register the plugin in your panel provider:
use SpykApp\FilamentPasswordlessLogin\FilamentPasswordlessLoginPlugin;
public function panel(Panel $panel): Panel
{
return $panel
->plugin(FilamentPasswordlessLoginPlugin::make());
}
Replace your default Filament login page with a magic link login:
FilamentPasswordlessLoginPlugin::make()
->loginPage(); // Enables magic link login by default
Visit /admin/login (or your panel's login path) to see the magic link login form.
Magic Link Login Page:
FilamentPasswordlessLoginPlugin::make()
->loginPage()
->redirectUrl('/admin/dashboard');
Login Action Integration:
SendMagicLinkAction to any Filament page or table.protected function getHeaderActions(): array
{
return [
SendMagicLinkAction::make()
->slideover()
->icon('heroicon-m-sparkles'),
];
}
Token Management:
FilamentPasswordlessLoginPlugin::make()
->resource()
->canCreateTokens()
->canDeleteTokens();
/admin/magic-links (or your custom slug) to view, generate, or invalidate tokens.Customization:
FilamentPasswordlessLoginPlugin::make()
->login(MyCustomLoginPage::class);
SendMagicLinkAction::make()
->icon('heroicon-m-envelope')
->color('success');
Multi-panel Support: Each panel auto-detects its own redirect URLs. Override per-panel if needed:
FilamentPasswordlessLoginPlugin::make()
->redirectUrl('/app/dashboard'); // For the 'app' panel
Standalone Actions:
Use SendMagicLinkAction in table rows or forms:
use SpykApp\FilamentPasswordlessLogin\Actions\SendMagicLinkAction;
MyResource::make()
->columns([
Tables\Columns\TextColumn::make('name'),
Tables\Columns\ActionColumn::make('actions')
->actions([
SendMagicLinkAction::make(),
]),
]);
Email Customization: Replace the default mailable or notification:
FilamentPasswordlessLoginPlugin::make()
->mailable(\App\Mail\CustomMagicLinkMail::class);
Widgets: Enable or disable resource page widgets:
FilamentPasswordlessLoginPlugin::make()
->statsWidget()
->chartsWidget(false);
Missing Migrations:
php artisan migrate after publishing migrations will cause errors when generating tokens.php artisan passwordless-login:upgrade if upgrading from an older version.Token Table Mismatch:
passwordless_login_tokens table by default. If you renamed it in config, ensure the plugin is configured to use the correct table name.config/passwordless-login.php for table_name.Caching Issues:
php artisan filament:cache-reset
Redirect URL Conflicts:
redirectUrl is not set, the plugin auto-detects from the Filament panel. Ensure your panel’s path() is correctly configured.->redirectUrl() if auto-detection fails.Action Position Overrides:
loginActionPosition is not set, the action defaults to disabled. Always specify a position:
->loginActionPosition(FilamentPasswordlessLoginActionPosition::EmailFieldHint)
Token Not Sending:
HasMagicLogin trait is added to your User model..env (e.g., MAIL_MAILER=smtp).php artisan queue:work if using queues.Expired Links:
passwordless-login.php).token_expiry_minutes or regenerate the token via the resource page.Action Not Showing:
->loginAction() is called and a position is set.Custom Login Page:
Extend SpykApp\FilamentPasswordlessLogin\Pages\MagicLinkLogin to override UI:
class CustomLogin extends MagicLinkLogin {
public function getHeading(): string {
return 'Secure Sign-In';
}
}
Register it:
FilamentPasswordlessLoginPlugin::make()
->login(CustomLogin::class);
Custom Mailable/Notification: Replace the default email template:
FilamentPasswordlessLoginPlugin::make()
->mailable(\App\Mail\CustomMagicLink::class);
Ensure your mailable extends SpykApp\PasswordlessLogin\Mail\MagicLinkMail.
Token Events:
Listen to token events (e.g., TokenCreated) for custom logic:
use SpykApp\PasswordlessLogin\Events\TokenCreated;
TokenCreated::subscribe(function (TokenCreated $event) {
// Custom logic (e.g., log token creation)
});
Slide-Over Modal: Customize the modal appearance by publishing and overriding the Blade template:
php artisan vendor:publish --tag=filament-passwordless-login-views
Edit resources/views/vendor/filament-passwordless-login/slideover.blade.php.
Priority Order: Plugin fluent API settings override config file settings, which override language file defaults. Example:
// Fluent API (highest priority)
FilamentPasswordlessLoginPlugin::make()
->loginActionIcon('heroicon-m-envelope');
// Config file (lower priority)
'login_action' => [
'icon' => 'heroicon-m-link',
];
Multi-Language:
Language files are published separately. Override translations in resources/lang/{locale}/filament-passwordless-login.php.
Resource Visibility: The token resource is enabled by default. Disable it if unused:
FilamentPasswordlessLoginPlugin::make()
->resource(false);
How can I help you explore Laravel packages today?