| 1234567891011121314151617181920212223242526272829303132333435 |
- <?php
- namespace App\Events;
- use Illuminate\Broadcasting\Channel;
- use Illuminate\Broadcasting\InteractsWithSockets;
- use Illuminate\Contracts\Broadcasting\ShouldBroadcastNow;
- use Illuminate\Foundation\Events\Dispatchable;
- use Illuminate\Queue\SerializesModels;
- class SendPersistentNotificationEvent implements ShouldBroadcastNow
- {
- use Dispatchable, InteractsWithSockets, SerializesModels;
- public const CHANNEL = 'actions';
- public function __construct(
- private readonly int $userId,
- private readonly array $notificationPayload,
- ) {}
- public function broadcastOn(): Channel
- {
- return new Channel(self::CHANNEL);
- }
- public function broadcastWith(): array
- {
- return [
- 'action' => 'persistent_notification',
- 'user_id' => $this->userId,
- 'notification' => $this->notificationPayload,
- ];
- }
- }
|