afea / filament-hero
Hero banner module for the Afea Filament CMS package ecosystem: headline, description, badge, feature bullets, CTA and background image.
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
Hero banner module for the Afea Filament CMS package ecosystem.
Ships:
Heromodel — headline + description + optional badge + CTA + feature bullets + image- Multiple heroes supported (for A/B testing, localized variants, seasonal campaigns)
- Reorderable Filament v4
HeroResourcewith a featureRepeater HeroPlugin+afea:install:hero
Installation
composer require afea/filament-hero php artisan afea:install:hero
Register in AdminPanelProvider:
->plugin(\Afea\Cms\Hero\Filament\HeroPlugin::make())
Three common scenarios
1. Render the primary hero on the home page
use Afea\Cms\Hero\Models\Hero; $hero = Hero::query()->active()->ordered()->first(); $hero?->title; $hero?->description; $hero?->featureList(); // sorted [{icon, title, order}, ...] $hero?->imageUrl('preview'); // webp preview
2. Localize or A/B test heroes
Run multiple active heroes with distinct order values and pick one on the front-end based on session/locale:
$heroes = Hero::query()->active()->ordered()->get(); $hero = $heroes->firstWhere('description', 'like', "%{$locale}%") ?? $heroes->first();
3. Override the model with a featured scope
class Hero extends \Afea\Cms\Hero\Models\Hero { public function scopeForCampaign($q, string $utm) { return $q->active()->where('cta_url', 'like', "%utm_campaign={$utm}%"); } }
'models' => ['hero' => \App\Models\Hero::class],