Aller au contenu
← Retour aux projets

Filament Announcement

#Filament Announcement

Latest Version Total Downloads PHP Version License

A powerful Filament plugin for broadcasting announcements to all users or specific recipients with support for scheduling, dismissible alerts, live updates, and custom recipient models.


#Screenshots

#List View

List Announcements

#Create Announcement

Create Announcement

#Edit Announcement

Edit Announcement

#Features

  • ✅ Global announcements
  • ✅ Targeted recipients
  • ✅ Dismissible announcements
  • ✅ Live polling updates
  • ✅ Scheduled announcements
  • ✅ Multiple announcement types
  • ✅ Translation ready
  • ✅ Filament native UI
  • ✅ Custom recipient models
  • ✅ User-specific visibility
  • ✅ Laravel policy support

#Installation

Install the package via Composer:

composer require hasanyagout/filament-announcements

[!IMPORTANT] If you are using Filament Panels and have not set up a custom theme yet, follow the official Filament documentation first:

https://filamentphp.com/docs/4.x/styling/overview#creating-a-custom-theme

After setting up a custom theme, add the plugin views to your theme CSS file:

@source '../../../../vendor/hasanyagout/filament-announcements/resources/**/*.blade.php';

Publish and run migrations:

php artisan vendor:publish --tag="announcements-migrations"
php artisan migrate

Publish the config file:

php artisan vendor:publish --tag="announcements-config"

Optionally publish translations:

php artisan vendor:publish --tag="announcements-translations"

Optionally publish views:

php artisan vendor:publish --tag="announcements-views"

#Setup

  1. Register the plugin inside your Filament panel provider:
use HasanYagout\Announcement\AnnouncementPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugins([
            AnnouncementPlugin::make(),
        ]);
}
  1. Add the trait to your User model:
use HasanYagout\Announcement\Traits\HasAnnouncements;

class User extends Authenticatable
{
    use HasAnnouncements;
}

#Configuration

Example configuration:

use App\Models\User;

return [

    'recipient_models' => [

        User::class => [
            'label' => 'Users',
            'title_attribute' => 'name',
        ],

    ],

];

#Polling Interval

Customize the polling interval:

AnnouncementPlugin::make()
    ->pollingInterval('10s')

#Announcement Types

Supported announcement types:

  • info
  • warning
  • danger
  • success

#Translation Support

The plugin is fully translation-ready.

Example:

__('announcement::filament.form.title.label')

#Scheduling

Announcements support scheduling using:

  • starts_at
  • ends_at

Only active announcements are displayed automatically.


#Dismissible Announcements

Users can dismiss announcements individually.

Dismiss states are stored per recipient.


#Recipient Targeting

Announcements can be:

  • Global (is_global)
  • Assigned to specific users/models

Supported via polymorphic recipient relationships.


#Permissions & Policies

The plugin supports Laravel Policies.

Example policy registration:


#Testing

composer test

#Changelog

Please see CHANGELOG for more information about recent changes.


#Contributing

Contributions, issues, and feature requests are welcome.

Please see CONTRIBUTING for details.


#Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.


#Credits


#License

The MIT License (MIT). Please see License File for more information.

Nouvelle version disponible.