28 lines
745 B
PHP
28 lines
745 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class MealPostsRequest extends FormRequest
|
|
{
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'image_url' => ['required', 'string', 'url', 'max:255'],
|
|
'caption' => ['nullable', 'string', 'max:1000'],
|
|
'calories' => ['nullable', 'integer', 'min:0'],
|
|
'proteins' => ['nullable', 'numeric', 'min:0'],
|
|
'carbs' => ['nullable', 'numeric', 'min:0'],
|
|
'fats' => ['nullable', 'numeric', 'min:0'],
|
|
'title' => ['required', 'string', 'max:255'],
|
|
'eaten_at' => ['required', 'date'],
|
|
];
|
|
}
|
|
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
}
|