app/Http/Controllers/API/Admin/ServiceController.php 1 location
|
@@ 59-73 (lines=15) @@
|
| 56 |
|
* @param int $id |
| 57 |
|
* @return array |
| 58 |
|
*/ |
| 59 |
|
public function view(Request $request, $id) |
| 60 |
|
{ |
| 61 |
|
$this->authorize('service-view', $request->apiKey()); |
| 62 |
|
|
| 63 |
|
$service = Service::findOrFail($id); |
| 64 |
|
$fractal = Fractal::create()->item($service); |
| 65 |
|
|
| 66 |
|
if ($request->input('include')) { |
| 67 |
|
$fractal->parseIncludes(explode(',', $request->input('include'))); |
| 68 |
|
} |
| 69 |
|
|
| 70 |
|
return $fractal->transformWith(new ServiceTransformer($request)) |
| 71 |
|
->withResourceName('service') |
| 72 |
|
->toArray(); |
| 73 |
|
} |
| 74 |
|
} |
| 75 |
|
|
app/Http/Controllers/API/User/ServerController.php 1 location
|
@@ 44-58 (lines=15) @@
|
| 41 |
|
* @param string $uuid |
| 42 |
|
* @return array |
| 43 |
|
*/ |
| 44 |
|
public function index(Request $request, $uuid) |
| 45 |
|
{ |
| 46 |
|
$this->authorize('user.server-view', $request->apiKey()); |
| 47 |
|
|
| 48 |
|
$server = Server::byUuid($uuid); |
| 49 |
|
$fractal = Fractal::create()->item($server); |
| 50 |
|
|
| 51 |
|
if ($request->input('include')) { |
| 52 |
|
$fractal->parseIncludes(explode(',', $request->input('include'))); |
| 53 |
|
} |
| 54 |
|
|
| 55 |
|
return $fractal->transformWith(new ServerTransformer) |
| 56 |
|
->withResourceName('server') |
| 57 |
|
->toArray(); |
| 58 |
|
} |
| 59 |
|
|
| 60 |
|
/** |
| 61 |
|
* Controller to handle request for server power toggle. |
app/Http/Controllers/API/Admin/NodeController.php 1 location
|
@@ 70-82 (lines=13) @@
|
| 67 |
|
* @param int $id |
| 68 |
|
* @return array |
| 69 |
|
*/ |
| 70 |
|
public function view(Request $request, $id) |
| 71 |
|
{ |
| 72 |
|
$this->authorize('node-view', $request->apiKey()); |
| 73 |
|
|
| 74 |
|
$fractal = Fractal::create()->item(Node::findOrFail($id)); |
| 75 |
|
if ($request->input('include')) { |
| 76 |
|
$fractal->parseIncludes(explode(',', $request->input('include'))); |
| 77 |
|
} |
| 78 |
|
|
| 79 |
|
return $fractal->transformWith(new NodeTransformer($request)) |
| 80 |
|
->withResourceName('node') |
| 81 |
|
->toArray(); |
| 82 |
|
} |
| 83 |
|
|
| 84 |
|
/** |
| 85 |
|
* Display information about a single node on the system. |
app/Http/Controllers/API/Admin/ServerController.php 1 location
|
@@ 71-85 (lines=15) @@
|
| 68 |
|
* @param int $id |
| 69 |
|
* @return array |
| 70 |
|
*/ |
| 71 |
|
public function view(Request $request, $id) |
| 72 |
|
{ |
| 73 |
|
$this->authorize('server-view', $request->apiKey()); |
| 74 |
|
|
| 75 |
|
$server = Server::findOrFail($id); |
| 76 |
|
$fractal = Fractal::create()->item($server); |
| 77 |
|
|
| 78 |
|
if ($request->input('include')) { |
| 79 |
|
$fractal->parseIncludes(explode(',', $request->input('include'))); |
| 80 |
|
} |
| 81 |
|
|
| 82 |
|
return $fractal->transformWith(new ServerTransformer($request)) |
| 83 |
|
->withResourceName('server') |
| 84 |
|
->toArray(); |
| 85 |
|
} |
| 86 |
|
|
| 87 |
|
/** |
| 88 |
|
* Create a new server on the system. |
app/Http/Controllers/API/Admin/UserController.php 1 location
|
@@ 70-82 (lines=13) @@
|
| 67 |
|
* @param int $id |
| 68 |
|
* @return array |
| 69 |
|
*/ |
| 70 |
|
public function view(Request $request, $id) |
| 71 |
|
{ |
| 72 |
|
$this->authorize('user-view', $request->apiKey()); |
| 73 |
|
|
| 74 |
|
$fractal = Fractal::create()->item(User::findOrFail($id)); |
| 75 |
|
if ($request->input('include')) { |
| 76 |
|
$fractal->parseIncludes(explode(',', $request->input('include'))); |
| 77 |
|
} |
| 78 |
|
|
| 79 |
|
return $fractal->transformWith(new UserTransformer($request)) |
| 80 |
|
->withResourceName('user') |
| 81 |
|
->toArray(); |
| 82 |
|
} |
| 83 |
|
|
| 84 |
|
/** |
| 85 |
|
* Create a new user on the system. |