1. Go to this page and download the library: Download rupadana/filament-announce library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use Rupadana\FilamentAnnounce\FilamentAnnouncePlugin;
use Filament\Support\Colors\Color;
class CustomersPanelProvider extends PanelProvider
{
public function panel(Panel $panel): Panel
{
return $panel
...
->plugin(
FilamentAnnouncePlugin::make()
->pollingInterval('30s') // optional, by default it is set to null
->defaultColor(Color::Blue) // optional, by default it is set to "primary"
)
}
}
use Rupadana\FilamentAnnounce\FilamentAnnouncePlugin;
use Filament\Support\Colors\Color;
class CustomersPanelProvider extends PanelProvider
{
public function panel(Panel $panel): Panel
{
return $panel
...
->plugin(
FilamentAnnouncePlugin::make()
->usingResource(MyCustomAnnouncementResource::class)
->pollingInterval('30s') // optional, by default it is set to null
->defaultColor(Color::Blue) // optional, by default it is set to "primary"
)
}
}
use App\Models\User;
use Rupadana\FilamentAnnounce\Announce;
Announce::make()
->title('Big News!')
->icon('heroicon-o-megaphone')
->body('Filament can now show very important message to specific users!')
->disableCloseButton() // Optional, if you want ur announcement discloseable
->announceTo(User::all());
use App\Models\User;
use Filament\Support\Enums\Alignment;
use Rupadana\FilamentAnnounce\Announce;
Announce::make()
->title('Big News!')
->icon('heroicon-o-megaphone')
->body('Filament can now show very important message to specific users!')
->alignment(Alignment::Center) // this will set both title and body alignments (common alignment)
->titleAlignment(Alignment::Start) // this will set title alignment and take precedence over common alignment methods
->bodyAlignment(Alignment::Start) // this will set body alignment and take precedence over common alignment methods
->actions([
Action::make('view')
->button(),
Action::make('undo')
->color('gray'),
])
->announceTo(User::all());
use App\Models\User;
use Rupadana\FilamentAnnounce\Announce;
Announce::make()
->title('Big News!')
->icon('heroicon-o-megaphone')
->body('Filament can now show very important message to specific users!')
->actions([
Action::make('view')
->button(),
Action::make('undo')
->color('gray'),
])
->announceTo(User::all());