ClearBowl/api/app/Http/Requests/AddProductRequest.php

46 lines
1016 B
PHP

<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class AddProductRequest extends FormRequest
{
/**
* 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 [
'name' => 'required',
'kcal' => 'required',
'carbohydrates' => 'required',
'protein' => 'required',
'fat' => 'required',
];
}
public function messages()
{
return [
'name.required' => 'Product name is required',
'kcal.required' => 'Kcal are required',
'carbohydrates.required' => 'Carbohydrates are required',
'protein.required' => 'Protein are required',
'fat.required' => 'Fat is required',
];
}
}