chanaged logic for rfq transporter bid #125

Merged
jothi merged 1 commits from ranjith-dev into master 2026-01-24 07:11:21 +00:00
2 changed files with 44 additions and 12 deletions

View File

@@ -5,6 +5,7 @@ namespace App\Filament\Resources\RfqTransporterBidResource\Pages;
use App\Filament\Resources\RfqTransporterBidResource; use App\Filament\Resources\RfqTransporterBidResource;
use App\Models\RfqTransporterBid; use App\Models\RfqTransporterBid;
use App\Models\User; use App\Models\User;
use App\Notifications\PushAlertNotification;
use Filament\Actions; use Filament\Actions;
use Filament\Facades\Filament; use Filament\Facades\Filament;
use Filament\Notifications\Notification; use Filament\Notifications\Notification;
@@ -32,11 +33,23 @@ class EditRfqTransporterBid extends EditRecord
$recipients->push($currentUser); $recipients->push($currentUser);
} }
$user1 = Filament::auth()->user();
Notification::make() Notification::make()
->title('Rank Updated') ->title('Rank Updated')
->body("Your current rank is #{$rank}") ->body("$currentUser current rank is #{$rank}")
->success() ->success()
->sendToDatabase($recipients); ->sendToDatabase($recipients);
$body = "$currentUser current rank is #{$rank}";
$user1->notify(new PushAlertNotification(
'Rank Update',
$body
));
} }
protected function getHeaderActions(): array protected function getHeaderActions(): array

View File

@@ -17,9 +17,18 @@ class PushAlertNotification extends Notification
/** /**
* Create a new notification instance. * Create a new notification instance.
*/ */
public function __construct() // public function __construct()
// {
// //
// }
public $title;
public $body;
public function __construct($title, $body)
{ {
// $this->title = $title;
$this->body = $body;
} }
public function via($notifiable) public function via($notifiable)
@@ -27,12 +36,22 @@ class PushAlertNotification extends Notification
return [WebPushChannel::class]; return [WebPushChannel::class];
} }
// public function toWebPush($notifiable, $notification)
// {
// return (new WebPushMessage)
// ->title('New Alert 🚨')
// ->icon('/pwa-192x192.png')
// ->body('You have a new notification')
// ->action('Open App', 'open_app')
// ->data(['url' => '/admin']);
// }
public function toWebPush($notifiable, $notification) public function toWebPush($notifiable, $notification)
{ {
return (new WebPushMessage) return (new WebPushMessage)
->title('New Alert 🚨') ->title($this->title)
->icon('/pwa-192x192.png') ->icon('/pwa-192x192.png')
->body('You have a new notification') ->body($this->body)
->action('Open App', 'open_app') ->action('Open App', 'open_app')
->data(['url' => '/admin']); ->data(['url' => '/admin']);
} }
@@ -50,13 +69,13 @@ class PushAlertNotification extends Notification
/** /**
* Get the mail representation of the notification. * Get the mail representation of the notification.
*/ */
public function toMail(object $notifiable): MailMessage // public function toMail(object $notifiable): MailMessage
{ // {
return (new MailMessage) // return (new MailMessage)
->line('The introduction to the notification.') // ->line('The introduction to the notification.')
->action('Notification Action', url('/')) // ->action('Notification Action', url('/'))
->line('Thank you for using our application!'); // ->line('Thank you for using our application!');
} // }
/** /**
* Get the array representation of the notification. * Get the array representation of the notification.