api: cleanup controllers
This commit is contained in:
parent
00c42225e8
commit
f78aaea6a3
47 changed files with 323 additions and 764 deletions
|
@ -4,6 +4,7 @@ namespace Pterodactyl\Http\Controllers\Api\Application\Eggs;
|
|||
|
||||
use Pterodactyl\Models\Egg;
|
||||
use Pterodactyl\Models\Nest;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Pterodactyl\Contracts\Repository\EggRepositoryInterface;
|
||||
use Pterodactyl\Transformers\Api\Application\EggTransformer;
|
||||
|
@ -16,15 +17,10 @@ use Pterodactyl\Http\Controllers\Api\Application\ApplicationApiController;
|
|||
|
||||
class EggController extends ApplicationApiController
|
||||
{
|
||||
/**
|
||||
* @var \Pterodactyl\Contracts\Repository\EggRepositoryInterface
|
||||
*/
|
||||
private $repository;
|
||||
private EggRepositoryInterface $repository;
|
||||
|
||||
/**
|
||||
* EggController constructor.
|
||||
*
|
||||
* @param \Pterodactyl\Contracts\Repository\EggRepositoryInterface $repository
|
||||
*/
|
||||
public function __construct(EggRepositoryInterface $repository)
|
||||
{
|
||||
|
@ -36,10 +32,6 @@ class EggController extends ApplicationApiController
|
|||
/**
|
||||
* Return an array of all eggs on a given nest.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Eggs\GetEggsRequest $request
|
||||
* @param \Pterodactyl\Models\Nest $nest
|
||||
*
|
||||
* @return array
|
||||
* @throws \Illuminate\Contracts\Container\BindingResolutionException
|
||||
*/
|
||||
public function index(GetEggsRequest $request, Nest $nest): array
|
||||
|
@ -56,10 +48,6 @@ class EggController extends ApplicationApiController
|
|||
/**
|
||||
* Returns a single egg.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Eggs\GetEggRequest $request
|
||||
* @param \Pterodactyl\Models\Egg $egg
|
||||
*
|
||||
* @return array
|
||||
* @throws \Illuminate\Contracts\Container\BindingResolutionException
|
||||
*/
|
||||
public function view(GetEggRequest $request, Egg $egg): array
|
||||
|
@ -72,9 +60,6 @@ class EggController extends ApplicationApiController
|
|||
/**
|
||||
* Creates a new egg.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Eggs\StoreEggRequest $request
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
* @throws \Illuminate\Contracts\Container\BindingResolutionException
|
||||
*/
|
||||
public function store(StoreEggRequest $request): JsonResponse
|
||||
|
@ -89,10 +74,6 @@ class EggController extends ApplicationApiController
|
|||
/**
|
||||
* Updates an egg.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Eggs\UpdateEggRequest $request
|
||||
* @param \Pterodactyl\Models\Egg $egg
|
||||
*
|
||||
* @return array
|
||||
* @throws \Illuminate\Contracts\Container\BindingResolutionException
|
||||
*/
|
||||
public function update(UpdateEggRequest $request, Egg $egg): array
|
||||
|
@ -107,16 +88,12 @@ class EggController extends ApplicationApiController
|
|||
/**
|
||||
* Deletes an egg.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Eggs\DeleteEggRequest $request
|
||||
* @param \Pterodactyl\Models\Egg $egg
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function delete(DeleteEggRequest $request, Egg $egg): JsonResponse
|
||||
public function delete(DeleteEggRequest $request, Egg $egg): Response
|
||||
{
|
||||
$egg->delete();
|
||||
|
||||
return new JsonResponse([], JsonResponse::HTTP_NO_CONTENT);
|
||||
return $this->returnNoContent();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue