Add comprehensive API documentation for the reporting endpoint: - Request/response structure - View type inference (did/is/will) - Blank vs explicit zero semantics - Status values and error responses Related to enhanced-allocation change.
25 lines
900 B
PHP
25 lines
900 B
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
class AllocationResource extends BaseResource
|
|
{
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'project_id' => $this->project_id,
|
|
'team_member_id' => $this->team_member_id,
|
|
'month' => $this->month?->format('Y-m'),
|
|
'allocated_hours' => $this->formatDecimal($this->allocated_hours),
|
|
'allocation_indicator' => $this->allocation_indicator ?? 'gray',
|
|
'created_at' => $this->formatDate($this->created_at),
|
|
'updated_at' => $this->formatDate($this->updated_at),
|
|
'project' => $this->whenLoaded('project', fn () => new ProjectResource($this->project)),
|
|
'team_member' => $this->whenLoaded('teamMember', fn () => new TeamMemberResource($this->teamMember)),
|
|
];
|
|
}
|
|
}
|