ldc-boutique-cnc/app/Http/Requests/ContactFormRequest.php

52 lines
1.3 KiB
PHP
Raw Normal View History

2021-04-06 12:56:54 +02:00
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class ContactFormRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
2022-08-25 12:26:43 +02:00
* @return boolean
2021-04-06 12:56:54 +02:00
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'last_name' => 'required|min:2',
'first_name' => 'required|min:2',
'email' => 'required|email:rfc,dns,spoof',
'subject' => 'required|min:2',
'order_ref' => 'sometimes',
'message' => 'required|min:20|max:1900',
'file' => 'nullable|mimes:jpg,jpeg,png,pdf|max:5120',
'ok_cgv' => 'accepted',
];
}
/**
* Get the error messages for the defined validation rules.
*
* @return array
*/
public function messages()
{
return [
'ok_cgv.accepted' => __('You must accept the terms and conditions and the privacy policy'),
2021-04-06 12:56:54 +02:00
'file.max' => __('La taille du fichier ne peut pas dépasser :max kilo-octets.'),
'file.mimes' => __('Le fichier doit être de type : :values.'),
];
}
}