31 lines
1.0 KiB
PHP
31 lines
1.0 KiB
PHP
<?php
|
|||
|
|
|
||
|
|
namespace App\Http\Resources;
|
||
|
|
|
||
|
|
use Illuminate\Http\Request;
|
||
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||
|
|
|
||
|
|
class UserResource extends JsonResource
|
||
|
|
{
|
||
|
|
public function toArray(Request $request): array
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'id' => $this->id,
|
||
|
|
'name' => $this->name,
|
||
|
|
'email' => $this->email,
|
||
|
|
'is_trainer' => (bool) $this->is_trainer,
|
||
|
|
'is_admin' => (bool) $this->is_admin,
|
||
|
|
'age' => $this->age,
|
||
|
|
'weight_kg' => $this->weight_kg !== null ? (float) $this->weight_kg : null,
|
||
|
|
'height_cm' => $this->height_cm !== null ? (float) $this->height_cm : null,
|
||
|
|
'fitness_level' => $this->fitness_level,
|
||
|
|
'goal' => $this->goal,
|
||
|
|
'health_notes' => $this->health_notes,
|
||
|
|
'available_equipment' => $this->available_equipment,
|
||
|
|
'days_per_week' => $this->days_per_week,
|
||
|
|
'minutes_per_session' => $this->minutes_per_session,
|
||
|
|
'created_at' => $this->created_at,
|
||
|
|
];
|
||
|
|
}
|
||
|
|
}
|