More work on the API utilizing Laravel 5.5 exception rendering
Also corrects API format to maintain JSONAPI spec
This commit is contained in:
parent
f30f4b45ba
commit
54b6fb5ebd
28 changed files with 464 additions and 391 deletions
31
app/Transformers/Api/Admin/AllocationTransformer.php
Normal file
31
app/Transformers/Api/Admin/AllocationTransformer.php
Normal file
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Transformers\Api\Admin;
|
||||
|
||||
use Pterodactyl\Models\Allocation;
|
||||
use Pterodactyl\Transformers\Api\ApiTransformer;
|
||||
|
||||
class AllocationTransformer extends ApiTransformer
|
||||
{
|
||||
/**
|
||||
* Return a generic transformed allocation array.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Allocation $allocation
|
||||
* @return array
|
||||
*/
|
||||
public function transform(Allocation $allocation)
|
||||
{
|
||||
return $this->transformWithFilter($allocation);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine which transformer filter to apply.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Allocation $allocation
|
||||
* @return array
|
||||
*/
|
||||
protected function transformWithFilter(Allocation $allocation)
|
||||
{
|
||||
return $allocation->toArray();
|
||||
}
|
||||
}
|
Reference in a new issue