<?php

namespace App\Http\Requests;


class MealPick extends BaseFormRequest
{

    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'meal_id' => 'bail|required|integer|exists:meals,id',
            'foods' => 'present|array',
            'foods.*.food_id' => 'bail|required|integer|exists:food,id',
            'foods.*.quantity' => 'bail|required|integer|min:1',
        ];
    }
}
