/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
$rules = [
'payout_method' => 'required:in,bankTransfer,paypal',
'paypal_email' => 'required_if:payment_type,paypal|email',
'receiver' => 'required_if:payment_type,bankTransfer|max:45',
'iban' => 'required_if:payment_type,bankTransfer|max:45|iban',
'bic' => 'required_if:payment_type,bankTransfer|max:15|bic',
];
return $rules;
}
/**
* Get the error messages for the defined validation rules.
*
* @return array
*/
public function messages()
{
return [
'payout_method.required' => trans('validation.attributes.payout_type_required'),
'paypal_email.required_if' => trans('validation.attributes.paypal_email_required'),
'paypal_email.email' => trans('validation.attributes.paypal_email_invalid'),
'iban.required_if' => trans('validation.attributes.bank_account_required'),
'bic.required_if' => trans('validation.attributes.bank_swift_required'),
'iban.iban' => trans('validation.attributes.bank_account_invalid'),
'bic.bic' => trans('validation.attributes.bank_swift_invalid'),
];
}
what i can do in this case? Laravel return 'The paypal email field is required.' for other fields this work, only not work with required_if