Xboard/app/Http/Resources/OrderResource.php

25 lines
555 B
PHP
Raw Normal View History

2025-01-06 12:20:11 -05:00
<?php
namespace App\Http\Resources;
use App\Services\PlanService;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
2025-01-09 19:00:27 -05:00
class OrderResource extends JsonResource
2025-01-06 12:20:11 -05:00
{
/**
* Transform the resource into an array.
*
* @return array<string, mixed>
*/
public function toArray(Request $request): array
{
return [
...parent::toArray($request),
'period' => PlanService::getLegacyPeriod($this->period),
2025-01-09 19:00:27 -05:00
'plan' => PlanResource::make($this->plan),
2025-01-06 12:20:11 -05:00
];
}
}