hasanyagout/filament-announcements 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

hasanyagout/filament-announcements

最新稳定版本:1.0.0

Composer 安装命令:

composer require hasanyagout/filament-announcements

包简介

Global announcement system for different users

README 文档

README

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.

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/announcements/resources/**/*.blade.php';

Publish and run migrations:

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

Publish the config file:

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

Optionally publish translations:

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

Optionally publish views:

php artisan vendor:publish --tag="announcement-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')

Custom Recipient Models

You can register custom recipient models dynamically:

AnnouncementPlugin::make()
    ->withCustomRecipients([
        App\Models\User::class => [
            'label' => 'Users',
            'title_attribute' => 'name',
        ],
    ])

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:

Screenshots

Add screenshots here later.

Example:

![Announcements](docs/images/announcements.png)

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.

统计信息

  • 总下载量: 14
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-05-25

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固