32 lines
883 B
PHP
32 lines
883 B
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use App\Models\WorkoutSessions;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
/** @mixin WorkoutSessions */
|
|
class WorkoutSessionsResource extends JsonResource
|
|
{
|
|
/**
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'externalId' => $this->external_id,
|
|
'source' => $this->source,
|
|
'type' => $this->type,
|
|
'title' => $this->title,
|
|
'durationSeconds' => $this->duration_seconds,
|
|
'caloriesBurned' => $this->calories_burned,
|
|
'distanceMeters' => (int) $this->distance_meters,
|
|
'startedAt' => $this->started_at,
|
|
'createdAt' => $this->created_at,
|
|
'updatedAt' => $this->updated_at,
|
|
];
|
|
}
|
|
}
|