afea / filament-popup
Popup module for the Afea Filament CMS package ecosystem: content popups with trigger rules and target-page matching.
v0.1.0
2026-04-21 10:48 UTC
Requires
- php: ^8.4
- afea/filament-cms-core: @dev
- filament/filament: ^4.0
- filament/spatie-laravel-media-library-plugin: ^4.0
- illuminate/contracts: ^12.0
- illuminate/database: ^12.0
- illuminate/support: ^12.0
- laravel/prompts: ^0.3
- spatie/laravel-medialibrary: ^11.0
Requires (Dev)
- laravel/pint: ^1.0
- orchestra/testbench: ^10.0
- pestphp/pest: ^4.0
- pestphp/pest-plugin-laravel: ^4.0
README
Popup module for the Afea Filament CMS package ecosystem.
Ships:
Popupmodel — content + image, display rules, target-page matchingPopupTriggerTypeenum:immediate,delay,scroll,exit_intent- Filament v4
PopupResourcewith RichEditor (sharesafea-cms.rich_content.blocks) PopupPluginfor panel registrationafea:install:popupinstaller
Installation
composer require afea/filament-popup php artisan afea:install:popup
Register in AdminPanelProvider:
->plugin(\Afea\Cms\Popup\Filament\PopupPlugin::make())
Picking the right popup on the front-end
use Afea\Cms\Popup\Models\Popup; $popups = Popup::active() ->orderBy('order') ->get() ->filter(fn (Popup $popup) => $popup->matchesPath(request()->path()));
matchesPath() honors both target_pages and exclude_pages, supporting * and /prefix/* globs. Exclusions win over inclusions.
Three common scenarios
1. Show once per visitor
Toggle show_once. Store a cookie on dismiss and skip the popup if present — the flag is just a signal for your front-end.
2. Custom trigger thresholds
display_rules is freeform JSON. The default schema ships with trigger_type, delay_seconds, scroll_percentage, target_pages, exclude_pages. Add your own keys (e.g. device: ['mobile']) by extending the form.
3. Override the Popup model
class Popup extends \Afea\Cms\Popup\Models\Popup { public function scopeForLocale(Builder $q, string $locale): Builder { return $q->whereJsonContains('display_rules->locales', $locale); } }
'models' => ['popup' => \App\Models\Popup::class],