52 lines
1.6 KiB
PHP
52 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
|
|
use Illuminate\Validation\Rule;
|
|
|
|
class CreateCustomerRequest extends ApiBaseRequest
|
|
{
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
"package_id"=>"required|integer",
|
|
"first_name"=>"required|string",
|
|
"last_name"=>"required|string",
|
|
'email' => 'required|email|unique:users,email',
|
|
'password'=>'required|min:8|regex:'.$this->password_validation_rule,
|
|
'birth_date'=>'required|date_format:m/d/Y|before:18 years ago|after:-150 years',
|
|
'full_ssn'=>'required|min:9|max:11',
|
|
'street_no'=>'required|string|max:5|regex:'.$this->street_validation_rule,
|
|
'street_name'=>'required|max:50|regex:'.$this->street_validation_rule,
|
|
'city'=>'required|string|regex:'.$this->script_validation_rule,
|
|
'state'=>'required|string|regex:'.$this->script_validation_rule,
|
|
'zip_code'=>'required|string|min:5|max:5|regex:'.$this->script_validation_rule,
|
|
'ssn'=>'required',
|
|
'card_number'=>'required',
|
|
'cvv_no'=>'required',
|
|
'expiry'=>'required',
|
|
'amount'=>'required',
|
|
'phone'=>'required|string|regex:'.$this->script_validation_rule,
|
|
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @return array|string[]
|
|
*/
|
|
public function messages(): array
|
|
{
|
|
return [
|
|
'street_name.max' => 'The street name may not be greater than 50 characters.',
|
|
'street_name.regex' => 'The street name may not be special characters.',
|
|
];
|
|
}
|
|
}
|