api: cleanup controllers
This commit is contained in:
parent
00c42225e8
commit
f78aaea6a3
47 changed files with 323 additions and 764 deletions
|
@ -7,22 +7,14 @@ use Webmozart\Assert\Assert;
|
|||
use Illuminate\Http\Response;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Container\Container;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Pterodactyl\Http\Controllers\Controller;
|
||||
use Pterodactyl\Extensions\Spatie\Fractalistic\Fractal;
|
||||
use Pterodactyl\Transformers\Api\Application\BaseTransformer;
|
||||
|
||||
abstract class ApplicationApiController extends Controller
|
||||
{
|
||||
/**
|
||||
* @var \Illuminate\Http\Request
|
||||
*/
|
||||
protected $request;
|
||||
|
||||
/**
|
||||
* @var \Pterodactyl\Extensions\Spatie\Fractalistic\Fractal
|
||||
*/
|
||||
protected $fractal;
|
||||
protected Request $request;
|
||||
protected Fractal $fractal;
|
||||
|
||||
/**
|
||||
* ApplicationApiController constructor.
|
||||
|
@ -56,11 +48,9 @@ abstract class ApplicationApiController extends Controller
|
|||
/**
|
||||
* Return an instance of an application transformer.
|
||||
*
|
||||
* @return \Pterodactyl\Transformers\Api\Application\BaseTransformer
|
||||
*
|
||||
* @throws \Illuminate\Contracts\Container\BindingResolutionException
|
||||
*/
|
||||
public function getTransformer(string $abstract)
|
||||
public function getTransformer(string $abstract): BaseTransformer
|
||||
{
|
||||
/** @var \Pterodactyl\Transformers\Api\Application\BaseTransformer $transformer */
|
||||
$transformer = Container::getInstance()->make($abstract);
|
||||
|
@ -72,6 +62,14 @@ abstract class ApplicationApiController extends Controller
|
|||
return $transformer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a HTTP/201 response for the API.
|
||||
*/
|
||||
protected function returnAccepted(): Response
|
||||
{
|
||||
return new Response('', Response::HTTP_ACCEPTED);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a HTTP/204 response for the API.
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue