buckets/app/Http/Resources/BucketResource.php

26 lines
871 B
PHP

<?php
namespace App\Http\Resources;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class BucketResource extends JsonResource
{
public function toArray(Request $request): array
{
return [
'id' => $this->uuid,
'name' => $this->name,
'priority' => $this->priority,
'sort_order' => $this->sort_order,
'allocation_type' => $this->allocation_type,
'allocation_value' => $this->allocation_value,
'allocation_type_label' => $this->getAllocationTypeLabel(),
'formatted_allocation_value' => $this->getFormattedAllocationValue(),
'current_balance' => $this->getCurrentBalance(),
'has_available_space' => $this->hasAvailableSpace(),
'available_space' => $this->getAvailableSpace(),
];
}
}