27 lines
651 B
PHP
27 lines
651 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use App\Enums\IngredientUnit;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
class MealPostIngredientsRequest extends FormRequest
|
|
{
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'meal_posts_id' => ['required', 'exists:meal_posts,id'],
|
|
'position' => ['required', 'integer'],
|
|
'ingredient' => ['required', 'string'],
|
|
'quantity' => ['required', 'integer', 'min:1'],
|
|
'unit' => ['required', Rule::enum(IngredientUnit::class)],
|
|
];
|
|
}
|
|
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
}
|