diff --git a/app/Events/LiveStream/StreamEnd.php b/app/Events/LiveStream/StreamEnd.php index 15f35ce40..f5416e4c5 100644 --- a/app/Events/LiveStream/StreamEnd.php +++ b/app/Events/LiveStream/StreamEnd.php @@ -9,22 +9,21 @@ use Illuminate\Broadcasting\PrivateChannel; use Illuminate\Contracts\Broadcasting\ShouldBroadcast; use Illuminate\Foundation\Events\Dispatchable; use Illuminate\Queue\SerializesModels; -use App\Models\LiveStream; class StreamEnd implements ShouldBroadcast { use Dispatchable, InteractsWithSockets, SerializesModels; - public $livestream; + public $id; /** * Create a new event instance. * * @return void */ - public function __construct(LiveStream $livestream) + public function __construct($id) { - $this->livestream = $livestream; + $this->id = $id; } /** @@ -34,7 +33,7 @@ class StreamEnd implements ShouldBroadcast */ public function broadcastOn() { - return new PrivateChannel('live.chat.' . $this->livestream->profile_id); + return new PrivateChannel('live.chat.' . $this->id); } public function broadcastAs() diff --git a/app/Events/LiveStream/StreamStart.php b/app/Events/LiveStream/StreamStart.php index c8517c2ce..54d9f1ff8 100644 --- a/app/Events/LiveStream/StreamStart.php +++ b/app/Events/LiveStream/StreamStart.php @@ -9,22 +9,21 @@ use Illuminate\Broadcasting\PrivateChannel; use Illuminate\Contracts\Broadcasting\ShouldBroadcast; use Illuminate\Foundation\Events\Dispatchable; use Illuminate\Queue\SerializesModels; -use App\Models\LiveStream; class StreamStart implements ShouldBroadcast { use Dispatchable, InteractsWithSockets, SerializesModels; - public $livestream; + public $id; /** * Create a new event instance. * * @return void */ - public function __construct(LiveStream $livestream) + public function __construct($id) { - $this->livestream = $livestream; + $this->id = $id; } /** @@ -34,7 +33,7 @@ class StreamStart implements ShouldBroadcast */ public function broadcastOn() { - return new PrivateChannel('live.chat.' . $this->livestream->profile_id); + return new PrivateChannel('live.chat.' . $this->id); } public function broadcastAs() diff --git a/app/Http/Controllers/LiveStreamController.php b/app/Http/Controllers/LiveStreamController.php index d423c415e..1faa44f18 100644 --- a/app/Http/Controllers/LiveStreamController.php +++ b/app/Http/Controllers/LiveStreamController.php @@ -147,7 +147,7 @@ class LiveStreamController extends Controller ->each(function($stream) { Storage::deleteDirectory("public/live-hls/{$stream->stream_id}"); LiveStreamService::clearChat($stream->profile_id); - StreamEnd::dispatch($stream); + StreamEnd::dispatch($stream->profile_id); $stream->delete(); }); @@ -377,7 +377,7 @@ class LiveStreamController extends Controller $stream->live_at = now(); $stream->save(); - StreamStart::dispatch($stream); + StreamStart::dispatch($stream->profile_id); return []; } else { abort(400); @@ -394,7 +394,7 @@ class LiveStreamController extends Controller $name = $url['name'] ?? $request->input('name'); $stream = LiveStream::whereStreamId($name)->whereStreamKey($url['key'])->firstOrFail(); - StreamEnd::dispatch($stream); + StreamEnd::dispatch($stream->profile_id); LiveStreamService::clearChat($stream->profile_id); if(config('livestreaming.broadcast.delete_token_after_finished')) {