public function addParticipant($userId)
    {
        $userIds = is_array($userId) ? $userId : (array) func_get_args();

        collect($userIds)->each(function ($userId) {
            Models::participant()->firstOrCreate([
                'user_id' => $userId,
                'thread_id' => $this->id,
            ]);
        });
    }
public function addParticipant($userId)
    {
        $userIds = is_array($userId) ? $userId : (array) func_get_args();

        collect($userIds)->each(function ($userId) {
            Models::participant()->firstOrCreate([
                'user_id' => $userId,
                'thread_id' => $this->id,
            ]);
        });
    }
public function addParticipant ( $ userId ) { $ userIds = is_array ( $ userId ) ? $ userId : ( array ) func_get_args ( ) ; collect ( $ userIds ) -> each ( function ( $ userId ) { Models :: participant ( ) -> firstOrCreate ( [ 'user_id' => $ userId , 'thread_id' => $ this -> id , ] ) ; } ) ; }
Add users to thread as participants.

@param array|mixed $userId

@return void
Add users to thread as participants .