2021-03-25 17:59:02 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
|
|
|
|
|
|
use Carbon\Carbon;
|
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
2021-03-26 16:10:56 +01:00
|
|
|
use App\Rules\Adult;
|
2021-03-25 17:59:02 +01:00
|
|
|
|
|
|
|
|
class CustomerRegisterRequest 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 [
|
|
|
|
|
'lastname' => 'required|string|max:255',
|
2021-03-26 16:10:56 +01:00
|
|
|
'firstname' => 'required|string|max:255',
|
2021-03-25 17:59:02 +01:00
|
|
|
'phone' => 'sometimes|max:255',
|
2021-03-26 16:10:56 +01:00
|
|
|
'address' => 'sometimes|max:255',
|
|
|
|
|
'postal_code' => 'required',
|
|
|
|
|
'town' => 'required|string|max:255',
|
|
|
|
|
'email' => 'required|email:rfc,dns,spoof|max:255',
|
2021-03-25 17:59:02 +01:00
|
|
|
'password' => 'required|confirmed|min:8|max:255',
|
2021-03-26 16:10:56 +01:00
|
|
|
'ok_cgv' => 'accepted',
|
2021-03-25 17:59:02 +01:00
|
|
|
'optin' => 'sometimes',
|
2021-03-26 16:10:56 +01:00
|
|
|
'birth_date' => ['required',new Adult()],
|
2021-03-25 17:59:02 +01:00
|
|
|
];
|
|
|
|
|
}
|
2021-03-26 16:10:56 +01:00
|
|
|
|
2021-03-25 17:59:02 +01:00
|
|
|
}
|