Files
nexusphp/app/Events/TorrentUpdated.php

43 lines
1007 B
PHP
Raw Permalink Normal View History

2022-03-26 04:27:04 +08:00
<?php
namespace App\Events;
use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
2024-04-25 02:15:56 +08:00
use Illuminate\Database\Eloquent\Model;
2022-03-26 04:27:04 +08:00
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
class TorrentUpdated
{
use Dispatchable, InteractsWithSockets, SerializesModels;
2024-04-25 02:15:56 +08:00
public ?Model $model = null;
2022-03-26 04:27:04 +08:00
2024-04-26 03:21:35 +08:00
public ?Model $modelOld = null;
2022-03-26 04:27:04 +08:00
/**
* Create a new event instance.
*
* @return void
*/
2025-09-14 00:47:09 +07:00
public function __construct(Model $model, ?Model $modelOld = null)
2022-03-26 04:27:04 +08:00
{
2024-04-25 02:15:56 +08:00
$this->model = $model;
2024-04-26 03:21:35 +08:00
$this->modelOld = $modelOld;
2022-03-26 04:27:04 +08:00
}
/**
* Get the channels the event should broadcast on.
*
* @return \Illuminate\Broadcasting\Channel|array
*/
public function broadcastOn()
{
return new PrivateChannel('channel-name');
}
}