PHPackages                             djl997/filament-model-activity-page - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. djl997/filament-model-activity-page

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

djl997/filament-model-activity-page
===================================

A reusable Filament v5 page that renders a chat-style activity feed for any Eloquent model with a polymorphic activities relation

0.1.10(3w ago)022MITPHPPHP ^8.2

Since May 19Pushed 3w agoCompare

[ Source](https://github.com/djl997/filament-model-activity-page)[ Packagist](https://packagist.org/packages/djl997/filament-model-activity-page)[ RSS](/packages/djl997-filament-model-activity-page/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (22)Versions (12)Used By (0)

filament-model-activity-page
============================

[](#filament-model-activity-page)

A reusable Filament v5 page that renders a chat-style activity feed for any Eloquent model with a polymorphic `activities` relation.

Requirements
------------

[](#requirements)

- PHP 8.2+
- Laravel 12+
- Filament 5+

Installation
------------

[](#installation)

```
composer require djl997/filament-model-activity-page
```

### 1. Publish and run the migration

[](#1-publish-and-run-the-migration)

```
php artisan vendor:publish --tag=filament-model-activity-page-migrations
php artisan migrate
```

### 2. Add the trait to your model

[](#2-add-the-trait-to-your-model)

```
use Djl997\FilamentModelActivityPage\Traits\HasActivities;

class Company extends Model
{
    use HasActivities;
}
```

### 3. Create a Filament page

[](#3-create-a-filament-page)

```
use Djl997\FilamentModelActivityPage\Pages\ActivityPage;

class Notes extends ActivityPage
{
    protected static string $resource = CompanyResource::class;

    protected function isPrivilegedUser(): bool
    {
        return auth()->user()->isAdmin();
    }

    protected function canSendInternalMessages(): bool
    {
        return auth()->user()->isAdmin();
    }

    protected function afterClientMessage(array $data): void
    {
        // Send notification, fire event, etc.
    }
}
```

### 4. Register the page in your resource

[](#4-register-the-page-in-your-resource)

```
public static function getPages(): array
{
    return [
        // ...
        'notes' => Notes::route('/{record}/notes'),
    ];
}
```

### 5. Add the package views to your Filament theme

[](#5-add-the-package-views-to-your-filament-theme)

In `resources/css/filament/app/theme.css`:

```
@source '../../../../vendor/djl997/filament-model-activity-page/resources/views/**/*';
```

Then rebuild: `npm run build`

Override points
---------------

[](#override-points)

MethodDefaultPurpose`getEagerLoadRelations()``['activities.user']`Add extra eager-load chains`getChatMessages()`loads `activities` on recordOverride to aggregate from related models`getChildActivities()``[]`Merge activities from child/related models into the feed`isPrivilegedUser()``false`Bypasses rate limiting`canSendInternalMessages()``false`Shows the internal checkbox on the compose form`afterClientMessage(array $data)`no-opSend notifications after a client posts`resolveActivityIcon(array $activity)``null`Return a Heroicon name to show an icon on any activity### Aggregating child model activities

[](#aggregating-child-model-activities)

Override `getChildActivities()` to pull activities from related (child) models into the same feed. Each entry must have an `activities` key (an iterable of Activity models) and a `context` key (a label shown on each message to indicate its origin).

```
protected function getChildActivities(): array
{
    return $this->getRecord()->dossiers->map(fn ($dossier) => [
        'activities' => $dossier->activities,
        'context'    => $dossier->title,
    ])->all();
}
```

The context label is rendered as a small faded tag next to the message text, so readers can tell which child record the activity belongs to. Activities on the page's own record show no context label.

### Adding icons to activities

[](#adding-icons-to-activities)

Override `resolveActivityIcon()` in your page class to return a Heroicon name for a given activity. The `$activity` array contains all formatted fields including `level`, `is_internal`, `message`, etc.

```
protected function resolveActivityIcon(array $activity): ?string
{
    // Show an envelope icon on event activities that contain "email" in the message
    if ($activity['level'] === 'event' && str_contains($activity['message'], 'email')) {
        return 'heroicon-m-envelope';
    }

    return null;
}
```

Icons are rendered on info-bar (Event) activities only. Chat bubbles do not show icons.

Configuration
-------------

[](#configuration)

Publish the config to swap in your own Activity model or customise internal message visibility:

```
php artisan vendor:publish --tag=filament-model-activity-page-config
```

```
// config/filament-model-activity-page.php
return [
    'activity_model' => App\Models\Activity::class,

    'internal_scope_callback' => function (\Illuminate\Database\Eloquent\Builder $query) {
        if (auth()->check() && ! auth()->user()->isAdmin()) {
            $query->where('is_internal', false);
        }
    },
];
```

Panel plugin registration (optional)
------------------------------------

[](#panel-plugin-registration-optional)

If you want to register the plugin explicitly with a Filament panel:

```
use Djl997\FilamentModelActivityPage\FilamentModelActivityPagePlugin;

->plugins([
    FilamentModelActivityPagePlugin::make(),
])
```

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance95

Actively maintained with recent releases

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~4 days

Recently: every ~10 days

Total

11

Last Release

25d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/27086857?v=4)[djl997](/maintainers/djl997)[@djl997](https://github.com/djl997)

---

Top Contributors

[![djl997](https://avatars.githubusercontent.com/u/27086857?v=4)](https://github.com/djl997 "djl997 (14 commits)")

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/djl997-filament-model-activity-page/health.svg)

```
[![Health](https://phpackages.com/badges/djl997-filament-model-activity-page/health.svg)](https://phpackages.com/packages/djl997-filament-model-activity-page)
```

###  Alternatives

[backstage/mails

View logged mails and events in a beautiful Filament UI.

16121.5k](/packages/backstage-mails)[stephenjude/filament-feature-flags

Filament implementation of feature flags and segmentation with Laravel Pennant.

123177.8k1](/packages/stephenjude-filament-feature-flags)[crumbls/layup

A visual page builder plugin for Filament 5 — Divi-style grid layouts with extensible widgets.

592.8k2](/packages/crumbls-layup)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.8k](/packages/rawilk-profile-filament-plugin)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
