定制 monzer/filament-email-verification-alert 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

monzer/filament-email-verification-alert

最新稳定版本:1.0.0

Composer 安装命令:

composer require monzer/filament-email-verification-alert

包简介

Send Email verifications on the fly!

README 文档

README

A Filament plugin that adds an email verification alert to your admin panel. This plugin integrates seamlessly with Filament's design and provides an easy way to alert users about email verification.

Features

  • 🔔 Email verification alert for unverified users
  • 🎨 Multiple color themes (yellow, blue, red)
  • 🌐 RTL support
  • ⚡ Lazy loading support
  • 💪 Customizable verification handling
  • 🔒 Session-based alert persistence
  • ✖️ Optional close button
  • 🔄 Configurable loading placeholder

Screenshots

Alert with Yellow Theme Alert with Blue Theme Alert with Red Theme

Installation

You can install the package via composer:

composer require monzer/filament-email-verification-alert

Basic Usage

In your FilamentServiceProvider or any service provider where you configure your panel, add:

use Monzer\FilamentEmailVerificationAlert\EmailVerificationAlertPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugins([
            EmailVerificationAlertPlugin::make(),
        ]);
}

Available Methods

Basic Configuration

EmailVerificationAlertPlugin::make()

Creates a new instance of the plugin.

Color Customization

->color('blue') // 'yellow', 'blue', or 'red'

Sets the color theme for the alert. Defaults to 'yellow'.

Alert Persistence

->persistClosedState() // Alert will stay hidden after being closed until the session ends

By default, the alert will reappear if the page is refreshed after closing. Using persistClosedState() makes the closed state persist throughout the user's session.

Alert Visibility Controls

Closable Button

->closable(false) // Removes the close button, making the alert persistent

By default, the alert shows a close button. You can disable it to make the alert persistent.

Placeholder Loading State

->placeholder(false) // Disables the loading placeholder

Control the visibility of the loading placeholder during lazy loading.

Verification Handler

->verifyUsing(function($user) {
    // Custom verification logic
    $user->notify(new CustomVerificationNotification());
    
     Notification::make()
     ->title(trans('filament-email-verification-alert::messages.verification.success'))
     ->success()
     ->send();
})

Customizes how verification emails are sent.

Position Customization

By default the panels::topbar.start hook is used to render the alert. But you can use any of the Render Hooks available in Filament using the renderHook() method as:

->renderHookName('panels::body.start')

Scoping

->renderHookScopes([ListUsers::class])

Limits where the alert appears. By default, shows on all pages.

Lazy Loading

->lazy(false) // Default is true

Controls whether the alert is lazy loaded.

Complete Example

use Monzer\FilamentEmailVerificationAlert\EmailVerificationAlertPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugins([
            EmailVerificationAlertPlugin::make()
                ->color('blue')
                ->persistClosedState()
                ->closable(true)
                ->placeholder(true)
                ->renderHookName('panels::body.start')
                ->renderHookScopes([ListUsers::class])
                ->lazy(false)
                ->verifyUsing(function($user) {
                 // Custom verification logic
                  $user->notify(new CustomVerificationNotification());
    
                  Notification::make()
                  ->title(trans('filament-email-verification-alert::messages.verification.success'))
                  ->success()
                  ->send();
                }),
        ]);
}

Method Chaining

All methods return the plugin instance, allowing for method chaining:

EmailVerificationAlertPlugin::make()
    ->color('blue')
    ->persistClosedState()
    ->closable(true)
    ->placeholder(true)
    ->lazy(false)
    ->renderHookName('panels::body.start');

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 469
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 7
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 7
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-02-12