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);
}
} `
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community