1. Go to this page and download the library: Download tomatophp/filament-alerts 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/ */
namespace App\Models;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Fortify\TwoFactorAuthenticatable;
use Laravel\Jetstream\HasProfilePhoto;
use Laravel\Sanctum\HasApiTokens;
use Spatie\Permission\Traits\HasRoles;
use TomatoPHP\FilamentAlerts\Traits\InteractsWithNotifications;
class User extends Authenticatable
{
use HasApiTokens;
use HasFactory;
use HasProfilePhoto;
use Notifiable;
use TwoFactorAuthenticatable;
use HasRoles;
use InteractsWithNotifications;
...
use Filament\Notifications\Notification;
Notification::make('send')
->title('Test Notifications')
->body('This is a test notification')
->icon('heroicon-o-bell')
->color('success')
->actions([
\Filament\Notifications\Actions\Action::make('view')
->label('View')
->url('https://google.com')
->markAsRead()
])
->sendUse(auth()->user(), \TomatoPHP\FilamentAlerts\Services\Drivers\EmailDriver::class);
use TomatoPHP\FilamentAlerts\Facades\FilamentAlerts;
FilamentAlerts::notify(User::first())
->template($template->id)
->title([
"find-text" => "change with this"
])
->body([
"find-text" => "change with this"
])
->send();
use TomatoPHP\FilamentAlerts\Facades\FilamentAlerts;
public function boot() {
FilamentAlerts::register(
\TomatoPHP\FilamentAlerts\Services\Concerns\NotificationDriver::make('database')
->label('Database')
->color('primary')
->icon('heroicon-o-bell')
->driver(\TomatoPHP\FilamentAlerts\Services\Drivers\DatabaseDriver::class)
);
}
use TomatoPHP\FilamentAlerts\Facades\FilamentAlerts;
public function boot() {
FilamentAlerts::register(
\TomatoPHP\FilamentAlerts\Services\Concerns\NotificationType::make('system')
->label('System')
->color('primary')
->icon('heroicon-o-bell')
);
}
use TomatoPHP\FilamentAlerts\Facades\FilamentAlerts;
public function boot() {
FilamentAlerts::register(
\TomatoPHP\FilamentAlerts\Services\Concerns\NotificationAction::make('system')
->label('System')
->color('primary')
->icon('heroicon-o-bell')
);
}
use TomatoPHP\FilamentAlerts\Facades\FilamentAlerts;
public function boot() {
FilamentAlerts::register(
\TomatoPHP\FilamentAlerts\Services\Concerns\NotificationUser::make(User::class)
->label('User')
->color('primary')
->icon('heroicon-o-bell')
);
}
use TomatoPHP\FilamentAlerts\Filament\Resources\NotificationsTemplateResource\Table\NotificationsTemplateTable;
public function boot()
{
NotificationsTemplateTable::register([
\Filament\Tables\Columns\TextColumn::make('something')
]);
}
use TomatoPHP\FilamentAlerts\Filament\Resources\NotificationsTemplateResource\Table\NotificationsTemplateActions;
public function boot()
{
NotificationsTemplateActions::register([
\Filament\Tables\Actions\ReplicateAction::make()
]);
}
use TomatoPHP\FilamentAlerts\Filament\Resources\NotificationsTemplateResource\Table\NotificationsTemplateFilters;
public function boot()
{
NotificationsTemplateFilters::register([
\Filament\Tables\Filters\SelectFilter::make('something')
]);
}
use TomatoPHP\FilamentAlerts\Filament\Resources\NotificationsTemplateResource\Table\NotificationsTemplateBulkActions;
public function boot()
{
NotificationsTemplateBulkActions::register([
\Filament\Tables\BulkActions\DeleteAction::make()
]);
}
use TomatoPHP\FilamentAlerts\Filament\Resources\NotificationsTemplateResource\Form\NotificationsTemplateForm;
public function boot()
{
NotificationsTemplateForm::register([
\Filament\Forms\Components\TextInput::make('something')
]);
}
use TomatoPHP\FilamentAlerts\Filament\Resources\NotificationsTemplateResource\Actions\ManagePageActions;
use TomatoPHP\FilamentAlerts\Filament\Resources\NotificationsTemplateResource\Actions\EditPageActions;
use TomatoPHP\FilamentAlerts\Filament\Resources\NotificationsTemplateResource\Actions\ViewPageActions;
use TomatoPHP\FilamentAlerts\Filament\Resources\NotificationsTemplateResource\Actions\CreatePageActions;
public function boot()
{
ManagePageActions::register([
Filament\Actions\Action::make('action')
]);
EditPageActions::register([
Filament\Actions\Action::make('action')
]);
ViewPageActions::register([
Filament\Actions\Action::make('action')
]);
CreatePageActions::register([
Filament\Actions\Action::make('action')
]);
}
use TomatoPHP\FilamentAlerts\Filament\Resources\NotificationsTemplateResource\Infolist\NotificationsTemplateInfoList;
public function boot()
{
NotificationsTemplateInfoList::register([
\Filament\Infolists\Components\TextEntry::make('something')
]);
}