Support the ongoing development of Laravel.io →
posted 3 years ago
Last updated 2 years ago.
0

Found and solution, probably it isn't the best option but it works.

`<?php

namespace App\Http\Controllers;

use TeamSpeak3\TeamSpeak3; use Illuminate\Http\Request;

class Person { public $nick; public $uuid;

public function setFullName($nick,$uuid) { $this->nick = $nick; $this->uuid = $uuid; } // end setFullName();

public function getFullName() { return $this->nick." ".$this->uuid; } // end getFullName(); }

class TeamSpeak3Controller extends Controller { public function clients() { $query = TeamSpeak3::factory("serverquery://...");

    $users = $query->clientList();
    $i = 0;
    $lista = array();

    foreach($users as $user)
    {
        $person[$i] = new Person;
        $person[$i]->setFullName(strval($user['client_nickname']),strval($user['client_unique_identifier']));
        array_push($lista,$person[$i]);
        $i++;
    }

    // $lista = array('1' => $person[0], '2' => $person[1]);

    return response()->json($lista);
}

} `

0

Sign in to participate in this thread!

Eventy

Your banner here too?

PiciuU piciuu Joined 19 May 2020

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.