MOON
Server: Apache
System: Linux e2e-78-16.ssdcloudindia.net 3.10.0-1160.45.1.el7.x86_64 #1 SMP Wed Oct 13 17:20:51 UTC 2021 x86_64
User: imensosw (1005)
PHP: 7.4.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: /home/imensosw/www/mpl.imenso.co/app/Events/FanCommentOnPost.php
<?php

namespace App\Events;

use App\Models\Comment as Comment;
use App\Models\User as User;
use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;

class FanCommentOnPost
{
    use Dispatchable, InteractsWithSockets, SerializesModels;

    public $comment;

    /**
     * Create a new event instance.
     *
     * @return void
     */
    public function __construct(Comment $comment)
    {
        $this->comment = $comment;
    }

    /*
     * Get the channels the event should broadcast on.
     *
     * @return Channel|array
     */
    // public function broadcastOn()
    // {
    //     $channels = [];

    //     if($this->comment->post->comments()->whereIn('user_id', $this->comment->user->friends())->count() > 0){
    //         foreach($this->comment->post->comments()->whereIn('user_id', $this->comment->user->friends())->distinct('user_id')->get() as $friends_comment)
    //         {

    //             $channels[] = new PrivateChannel('user_'.$this->requestee->id);
    //         }
    //     }

    //     return $channels;
    // }

    // public function broadcastAs()
    // {
    //     return 'fan.friend.also.commented.on.post';
    // }

    // public function broadcastWith()
    // {
    //     return [
    //         'action' => 'add-notification',
    //         'html' => view('notifications/fan/friend-also-commented-on-post')->with([
    //             'comment' => $this->comment
    //         ])->render()
    //     ];
    // }
}