33 lines
1.0 KiB
PHP
33 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class WageResource extends JsonResource
|
|
{
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'therapist' => [
|
|
'id' => $this->user->id,
|
|
'name' => $this->user->name,
|
|
],
|
|
'period_start' => $this->period_start->format('Y-m-d'),
|
|
'period_end' => $this->period_end->format('Y-m-d'),
|
|
'sessions_count' => $this->sessions_count,
|
|
'hours_worked' => $this->hours_worked,
|
|
'base_amount' => $this->base_amount,
|
|
'bonus' => $this->bonus,
|
|
'deductions' => $this->deductions,
|
|
'total_amount' => $this->total_amount,
|
|
'currency' => new CurrencyResource($this->currency),
|
|
'status' => $this->status,
|
|
'notes' => $this->notes,
|
|
'created_at' => $this->created_at?->format('Y-m-d H:i:s'),
|
|
];
|
|
}
|
|
}
|