Very rough go at getting API back into operational state.

Not spending a lot of time on this as its a pre-release and I have
plans to overhaul the API to actually work and be easy to maintain.
This commit is contained in:
Dane Everitt 2017-03-19 13:20:33 -04:00
parent 4e916cbf08
commit 5e27772fef
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
7 changed files with 189 additions and 333 deletions

View file

@ -24,31 +24,20 @@
namespace Pterodactyl\Http\Controllers\API;
use Pterodactyl\Models;
use Illuminate\Http\Request;
use Pterodactyl\Models\Service;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* @Resource("Services")
*/
class ServiceController extends BaseController
{
public function __construct()
public function index(Request $request)
{
//
}
public function lists(Request $request)
{
return Models\Service::all()->toArray();
return Service::all()->toArray();
}
public function view(Request $request, $id)
{
$service = Models\Service::with('options.variables', 'options.packs')->find($id);
if (! $service) {
throw new NotFoundHttpException('No service by that ID was found.');
}
$service = Service::with('options.variables', 'options.packs')->findOrFail($id);
return $service->toArray();
}