feat: history and calculate needs for user
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Models\NutritionPlan;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
/** @mixin NutritionPlan */
|
||||
class NutritionPlanResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'source' => $this->source,
|
||||
'formulaVersion' => $this->formula_version,
|
||||
'calories' => $this->calories,
|
||||
'proteins' => $this->proteins,
|
||||
'carbs' => $this->carbs,
|
||||
'fats' => $this->fats,
|
||||
'restingMetabolism' => $this->resting_metabolism,
|
||||
'maintenanceCalories' => $this->maintenance_calories,
|
||||
'calorieAdjustmentPercent' => $this->calorie_adjustment_percent,
|
||||
'calculationDetails' => $this->calculation_details,
|
||||
'effectiveFrom' => $this->effective_from?->toISOString(),
|
||||
'effectiveUntil' => $this->effective_until?->toISOString(),
|
||||
'isActive' => $this->is_active,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user