Files
daily-meal-api/app/Http/Requests/StoreWeightEntryRequest.php
T
leonm 69372a49ed
CI / 🧪 Tests Laravel (push) Failing after 2m18s
CI / 🐳 Build & Push Images (push) Has been skipped
feat: history and calculate needs for user
2026-08-14 12:45:37 +02:00

30 lines
756 B
PHP

<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class StoreWeightEntryRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return $this->user()?->hasCompletedNutritionOnboarding() === true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'weightKg' => ['required', 'numeric', 'min:35', 'max:300'],
'measuredAt' => ['sometimes', 'nullable', 'date', 'before_or_equal:now'],
];
}
}