mirror of
https://github.com/MrUnknownDE/panel.git
synced 2026-04-09 18:03:44 +02:00
Finish base API.
Making PR, any additional API functions or modifications can be done within the repository now.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Pterodactyl\Http\Controllers\API;
|
||||
|
||||
use DB;
|
||||
use Illuminate\Http\Request;
|
||||
use Pterodactyl\Models\Location;
|
||||
|
||||
@@ -27,7 +28,16 @@ class LocationController extends BaseController
|
||||
*/
|
||||
public function getLocations(Request $request)
|
||||
{
|
||||
return Location::all();
|
||||
$locations = Location::select('locations.*', DB::raw('GROUP_CONCAT(nodes.id) as nodes'))
|
||||
->join('nodes', 'locations.id', '=', 'nodes.location')
|
||||
->groupBy('locations.id')
|
||||
->get();
|
||||
|
||||
foreach($locations as &$location) {
|
||||
$location->nodes = explode(',', $location->nodes);
|
||||
}
|
||||
|
||||
return $locations;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user