2017-04-09 17:15:15 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Pterodactyl - Panel
|
|
|
|
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
|
|
|
|
*
|
2017-09-26 02:43:01 +00:00
|
|
|
* This software is licensed under the terms of the MIT license.
|
|
|
|
* https://opensource.org/licenses/MIT
|
2017-04-09 17:15:15 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
namespace Pterodactyl\Http\Controllers\API\Admin;
|
|
|
|
|
|
|
|
use Fractal;
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
use Pterodactyl\Models\Location;
|
|
|
|
use Pterodactyl\Http\Controllers\Controller;
|
|
|
|
use Pterodactyl\Transformers\Admin\LocationTransformer;
|
|
|
|
|
|
|
|
class LocationController extends Controller
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Controller to handle returning all locations on the system.
|
|
|
|
*
|
2017-08-22 03:10:48 +00:00
|
|
|
* @param \Illuminate\Http\Request $request
|
2017-04-09 17:15:15 +00:00
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function index(Request $request)
|
|
|
|
{
|
|
|
|
$this->authorize('location-list', $request->apiKey());
|
|
|
|
|
|
|
|
return Fractal::create()
|
|
|
|
->collection(Location::all())
|
|
|
|
->transformWith(new LocationTransformer($request))
|
|
|
|
->withResourceName('location')
|
|
|
|
->toArray();
|
|
|
|
}
|
|
|
|
}
|