Overview

Media Drive is a first-party Filament 5 panel plugin that adds a Drive-style media browser (grid and list) and a reusable picker field. It is built on Spatie Media Library and the Flysystem s3 disk — it does not introduce a second media table. The package ships inside the Qcentic Edge template at packages/filament-media-drive as a Composer path repository, so a fresh clone already has it; there is no composer require step on a clone.

Components

The package (mamenein/filament-media-drive, namespace Mamenein\FilamentMediaDrive) provides:

  • MediaDrivePlugin — the Plugin object (getId / register / boot). Registered on a panel with MediaDrivePlugin::make(); register() adds the Drive page.
  • DrivePage (Pages\DrivePage) — a custom panel page at slug drive that renders the drive-browser view and embeds a MediaPicker. Layout toggles between grid and list via header actions.
  • MediaPicker (Forms\Components\MediaPicker) — a standalone form field that lists media the current user may view and validates the submitted id against the same policy.
  • EditorImageStore (Support\EditorImageStore) — the ingest path used by MediaMarkdownEditor, MediaRichEditor, and MediaLibraryFileUpload to persist Livewire uploads as Spatie media on the s3 disk.

Relationship to Spatie

All records are Spatie Media models. MediaDriveCatalog scopes every query to disk = 's3' (MediaDriveCatalog::DISK), so the Drive and picker only ever surface media on that disk. Public URLs come from $media->getUrl(): the disk url / AWS_URL when a CDN is configured (Bunny pull zone in production), otherwise the direct disk URL. Local compose points the same disk at MinIO; production points it at Bunny Storage.

Authorization and navigation

Access is gated by the host app's MediaPolicy through the Laravel GateviewAny for the page, view for individual media. In practice that means Shield permissions: guests are sent to login, users without the media permission get 403, owners see their own files, super_admin sees everything. On the raw template the Drive page sets $shouldRegisterNavigation = false, so it is reachable at /drive but absent from the sidebar — Media Library is the nav entry. Clones re-enable navigation as needed.

flowchart LR
    Panel --> DrivePage["Drive page (/drive)"]
    DrivePage -->|grid / list| SpatieMedia["Spatie Media (disk = s3)"]
    SpatieMedia --> S3["s3 disk: MinIO (local) / Bunny (prod)"]
    S3 --> CDN["CDN via AWS_URL"]
    MediaPicker["MediaPicker field"] -->|select existing| SpatieMedia
    MediaPicker -->|upload new| EditorImageStore --> SpatieMedia

See also

Built by Qcentic