ldc-doux/app/Http/Requests/ContactFormRequest.php
Olivier Legat fee051a7de Squashed commit of the following:
commit c87deb1d185b5cce65e417fde124a2691e268355
Author: Sebastien Hattry <sebastien.hattry@ldc.fr>
Date:   Wed Apr 13 10:58:17 2022 +0200

    Fix bug when product not published but display

commit 93de503ce91b3f36251f00340344046aa8218b36
Author: Sebastien Hattry <sebastien.hattry@ldc.fr>
Date:   Wed Apr 13 10:57:11 2022 +0200

    Product in BO - Gamme required setting

commit b1da45a5fba0c4a8aacbe10d06ada6ef93e748a0
Author: Sebastien Hattry <sebastien.hattry@ldc.fr>
Date:   Tue Apr 12 17:45:21 2022 +0200

    Header - Size of search picture fix bug in IOS

commit 590772a2483be51dc9e89aa44822e20eb414dca6
Author: Sebastien Hattry <sebastien.hattry@ldc.fr>
Date:   Tue Apr 12 10:18:46 2022 +0200

    Slide - Remove title and text display in BO

commit 08daf95799ab591167f33dfad6a6fec37aa4090a
Author: Sebastien Hattry <sebastien.hattry@ldc.fr>
Date:   Tue Apr 12 10:13:41 2022 +0200

    form Contact : add drom list if france choose

commit f5ba031076bbb51655eaa2451bce06902191c116
Author: Sebastien Hattry <sebastien.hattry@ldc.fr>
Date:   Tue Apr 12 09:59:16 2022 +0200

    Add story line Svg if needed
2022-04-26 09:42:40 +02:00

62 lines
1.9 KiB
PHP

<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class ContactFormRequest 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 [
'civilite' => 'required|in:monsieur,madame',
'name' => 'required|min:2',
'lastname' => 'required|min:2',
'address' => 'required|max:255',
'postcode' => 'required',
'city' => 'required|string|max:255',
'phone' => 'required|max:255',
'email' => 'required|email:rfc,dns,spoof|max:255',
'country' => 'required|string|max:255',
'departement' => 'required_if:country,France|max:255',
'topic' => 'required',
'product_name' => 'required_if:topic,Réclamation|max:255',
'barcode' => 'required_if:topic,Réclamation|max:128',
'shop' => 'required_if:topic,Réclamation|max:255',
'lot' => 'required_if:topic,Réclamation|max:255',
'limit_date' => 'required_if:topic,Réclamation|date|nullable',
'consumption_date' => 'required_if:topic,Réclamation|date|nullable',
'message' => 'required|min:25',
'file' => 'nullable|mimes:jpg,jpeg,png,pdf|max:5120',
];
}
/**
* Get the error messages for the defined validation rules.
*
* @return array
*/
public function messages()
{
return [
'topic.required' => __('Veuille préciser la nature de votre demande.'),
'file.max' => __('La taille du fichier ne peut pas dépasser :max kilo-octets.'),
'file.mimes' => __('Le fichier doit être de type : :values.'),
];
}
}