afea/filament-media

Media gallery module for the Afea Filament CMS package ecosystem: curated media items with an image, an optional file and rich notes.

Maintainers

Package info

github.com/AfeaSoftware/filament-media

pkg:composer/afea/filament-media

Statistics

Installs: 1

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 0

v0.1.0 2026-04-21 10:48 UTC

This package is auto-updated.

Last update: 2026-04-21 11:57:54 UTC


README

Media gallery module for the Afea Filament CMS package ecosystem.

Ships:

  • MediaItem model — title + description + rich note + two media collections (image + downloadable file) via Spatie
  • Reorderable Filament v4 MediaItemResource with RichEditor (shares afea-cms.rich_content.blocks)
  • MediaPlugin + afea:install:media installer

Pair this with afea/filament-files when you need:

  • filament-media — curated press kit / gallery items (1 image + 1 optional downloadable) with rich editorial notes.
  • filament-files — flat document/link lists grouped by a string group, no editorial metadata.

Installation

composer require afea/filament-media
php artisan afea:install:media

Register in AdminPanelProvider:

->plugin(\Afea\Cms\Media\Filament\MediaPlugin::make())

Three common scenarios

1. Render a gallery on a Blade page

use Afea\Cms\Media\Models\MediaItem;

$gallery = MediaItem::query()->active()->ordered()->get();

foreach ($gallery as $item) {
    $item->imageUrl('preview');  // thumbnail
    $item->imageUrl();            // original
    $item->fileUrl();             // optional downloadable
}

2. Private disk for gated press kits

AFEA_MEDIA_DISK=s3-private

Both image and file collections move to the new disk. For signed URLs use getFirstMedia('media/files')?->getTemporaryUrl(...).

3. Model override with a custom featured scope

class MediaItem extends \Afea\Cms\Media\Models\MediaItem
{
    public function scopeFeatured($q)
    {
        return $q->active()->where('order', '<=', 6);
    }
}
'models' => ['media_item' => \App\Models\MediaItem::class],