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

46 lines
1016 B
PHP
Raw Normal View History

2019-12-04 12:49:41 +01:00
<?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',
2019-12-15 15:45:22 +01:00
'kcal' => 'required',
'carbohydrates' => 'required',
'protein' => 'required',
'fat' => 'required',
2019-12-04 12:49:41 +01:00
];
}
public function messages()
{
return [
'name.required' => 'Product name is required',
2019-12-15 15:45:22 +01:00
'kcal.required' => 'Kcal are required',
'carbohydrates.required' => 'Carbohydrates are required',
'protein.required' => 'Protein are required',
'fat.required' => 'Fat is required',
2019-12-04 12:49:41 +01:00
];
}
}