113 lines
5.7 KiB
PHP
113 lines
5.7 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Bo;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class FoodProductRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*
|
|
* @return boolean
|
|
*/
|
|
public function authorize()
|
|
{
|
|
return \auth()->check();
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function rules()
|
|
{
|
|
return [
|
|
'no_art' => 'sometimes|nullable|integer',
|
|
'ingredients' => 'sometimes|nullable|string|min:15',
|
|
'preparation' => 'sometimes|nullable|string|min:15',
|
|
'servings' => 'sometimes|nullable|string|max:20',
|
|
'allergens' => 'sometimes|nullable|string|min:15',
|
|
'selling_argument' => 'sometimes|nullable|string|min:15',
|
|
'nv_ref_weight_g' => 'sometimes|nullable|numeric|max:9999',
|
|
'nv_kj' => 'sometimes|nullable|numeric|max:9999',
|
|
'nv_kcal' => 'sometimes|nullable|numeric|max:9999',
|
|
'nv_fat_g' => 'sometimes|nullable|numeric|max:9999',
|
|
'nv_sat_fat_g' => 'sometimes|nullable|numeric|max:9999',
|
|
'nv_carb_g' => 'sometimes|nullable|numeric|max:9999',
|
|
'nv_sugar_g' => 'sometimes|nullable|numeric|max:9999',
|
|
'nv_fiber_g' => 'sometimes|nullable|numeric|max:9999',
|
|
'nv_protein_g' => 'sometimes|nullable|numeric|max:9999',
|
|
'nv_salt_g' => 'sometimes|nullable|numeric|max:9999',
|
|
'nv_serving_size_g' => 'sometimes|nullable|numeric|max:9999',
|
|
'nv_serving_kj' => 'sometimes|nullable|numeric|max:9999',
|
|
'nv_serving_kcal' => 'sometimes|nullable|numeric|max:9999',
|
|
'nv_serving_fat_g' => 'sometimes|nullable|numeric|max:9999',
|
|
'nv_serving_sat_fat_g' => 'sometimes|nullable|numeric|max:9999',
|
|
'nv_serving_carb_g' => 'sometimes|nullable|numeric|max:9999',
|
|
'nv_serving_sugar_g' => 'sometimes|nullable|numeric|max:9999',
|
|
'nv_serving_fiber_g' => 'sometimes|nullable|numeric|max:9999',
|
|
'nv_serving_protein_g' => 'sometimes|nullable|numeric|max:9999',
|
|
'nv_serving_salt_g' => 'sometimes|nullable|numeric|max:9999',
|
|
'nv_daily_energy' => 'sometimes|nullable|numeric|max:9999',
|
|
'nv_daily_fat' => 'sometimes|nullable|numeric|max:9999',
|
|
'nv_daily_sat_fat' => 'sometimes|nullable|numeric|max:9999',
|
|
'nv_daily_carb' => 'sometimes|nullable|numeric|max:9999',
|
|
'nv_daily_sugar' => 'sometimes|nullable|numeric|max:9999',
|
|
'nv_daily_fiber' => 'sometimes|nullable|numeric|max:9999',
|
|
'nv_daily_protein' => 'sometimes|nullable|numeric|max:9999',
|
|
'nv_daily_salt' => 'sometimes|nullable|numeric|max:9999',
|
|
'nutriscore' => 'sometimes|nullable|string|min:1|max:1',
|
|
'nutriscore_args' => 'sometimes|nullable|string|min:15',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Get custom attributes for validator errors.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function attributes()
|
|
{
|
|
return [
|
|
'product_type' => \trans('type du produit'),
|
|
'no_art' => \trans('numéro article du produit'),
|
|
'ingredients' => \trans('ingredients du produit'),
|
|
'preparation' => \trans('preparation du produit'),
|
|
'servings' => \trans('portions du produit'),
|
|
'allergens' => \trans('allergènes du produit'),
|
|
'selling_argument' => \trans('argument de vente du produit'),
|
|
'nv_ref_weight_g' => \trans('poids de référence du produit'),
|
|
'nv_kj' => \trans('énergie en Kj du produit'),
|
|
'nv_kcal' => \trans('énergie en Kcal du produit'),
|
|
'nv_fat_g' => \trans('graisses du produit'),
|
|
'nv_sat_fat_g' => \trans('dont acides gras saturés du produit'),
|
|
'nv_carb_g' => \trans('glucides du produit'),
|
|
'nv_sugar_g' => \trans('dont sucres du produit'),
|
|
'nv_fiber_g' => \trans('fibres alimentaires du produit'),
|
|
'nv_protein_g' => \trans('protéines du produit'),
|
|
'nv_salt_g' => \trans('sel du produit'),
|
|
'nv_serving_size_g' => \trans('par portion - portion du produit'),
|
|
'nv_serving_kj' => \trans('par portion - énergie en Kj du produit'),
|
|
'nv_serving_kcal' => \trans('par portion - énergie en Kcal du produit'),
|
|
'nv_serving_fat_g' => \trans('par portion - graisses du produit'),
|
|
'nv_serving_sat_fat_g' => \trans('par portion - dont acides gras saturés du produit'),
|
|
'nv_serving_carb_g' => \trans('par portion - glucides du produit'),
|
|
'nv_serving_sugar_g' => \trans('par portion - dont sucres du produit'),
|
|
'nv_serving_fiber_g' => \trans('par portion - fibres alimentaires du produit'),
|
|
'nv_serving_protein_g' => \trans('par portion - protéines du produit'),
|
|
'nv_serving_salt_g' => \trans('par portion - sel du produit'),
|
|
'nv_daily_energy' => \trans('% de APR - énergie du produit'),
|
|
'nv_daily_fat' => \trans('% de APR - graisses du produit'),
|
|
'nv_daily_sat_fat' => \trans('% de APR - dont acides gras saturés du produit'),
|
|
'nv_daily_carb' => \trans('% de APR - glucides du produit'),
|
|
'nv_daily_sugar' => \trans('% de APR - dont sucres du produit'),
|
|
'nv_daily_fiber' => \trans('% de APR - fibres alimentaires du produit'),
|
|
'nv_daily_protein' => \trans('% de APR - protéines'),
|
|
'nv_daily_salt' => \trans('% de APR - sel'),
|
|
'nutriscore' => \trans('nutriscore du produit'),
|
|
'nutriscore_args' => \trans('arguments nutriscore du produit'),
|
|
];
|
|
}
|
|
}
|