PHP code example of webbingbrasil / filament-notification
1. Go to this page and download the library: Download webbingbrasil/filament-notification 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/ */
webbingbrasil / filament-notification example snippets
namespace App\Notifications;
use Illuminate\Notifications\Notification;
use Webbingbrasil\FilamentNotification\Notifications\NotificationLevel;
class UserNotification extends Notification
{
public function via($notifiable)
{
return [
'database'
];
}
public function toArray($notifiable)
{
return [
'level' => NotificationLevel::INFO,
'title' => 'Info notification',
'message' => 'Lorem ipsum'
];
}
}
namespace App\Notifications;
use Illuminate\Notifications\Notification;
use Webbingbrasil\FilamentNotification\Actions\ButtonAction;
class UserNotification extends Notification
{
static public function notificationFeedActions()
{
return [
ButtonAction::make('markRead')->icon('heroicon-o-check')
->label('Mark as read')
->hidden(fn($record) => $record->read()) // Use $record to access/update notification, this is DatabaseNotification model
->action(function ($record, $livewire) {
$record->markAsRead();
$livewire->refresh(); // $livewire can be used to refresh ou reset notification feed
})
->outlined()
->color('secondary'),
ButtonAction::make('profile')
->label('Complete Profile')
->hidden(fn($record) => $record->read())
->icon('heroicon-o-user')
->action(function ($record, $livewire, $data) {
$record->markAsRead();
$livewire->refresh();
Auth::user()->update($data);
})
->form([
DatePicker::make('birthday')
->label('Birthday')
->
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.