diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index 148dbb3..b86132e 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -46,20 +46,20 @@ class UserController extends Controller $request->validate([ 'firstname' => 'required', 'surname' => 'required', - 'email' => 'required|email|unique:users,email', + 'email' => 'required|email', 'phone' => 'required', - 'home_address' => 'required', - 'home_city' => 'required', - 'home_postcode' => 'required', - 'home_country' => 'required', - 'home_state' => 'required', + 'home_address' => 'required_with:home_city,home_postcode,home_country,home_state', + 'home_city' => 'required_with:home_address,home_postcode,home_country,home_state', + 'home_postcode' => 'required_with:home_address,home_city,home_country,home_state', + 'home_country' => 'required_with:home_address,home_city,home_postcode,home_state', + 'home_state' => 'required_with:home_address,home_city,home_postcode,home_country', - 'billing_address' => 'required', - 'billing_city' => 'required', - 'billing_postcode' => 'required', - 'billing_country' => 'required', - 'billing_state' => 'required', + 'billing_address' => 'required_with:billing_city,billing_postcode,billing_country,billing_state', + 'billing_city' => 'required_with:billing_address,billing_postcode,billing_country,billing_state', + 'billing_postcode' => 'required_with:billing_address,billing_city,billing_country,billing_state', + 'billing_country' => 'required_with:billing_address,billing_city,billing_postcode,billing_state', + 'billing_state' => 'required_with:billing_address,billing_city,billing_postcode,billing_country', ], [ 'firstname.required' => __('validation.custom_messages.firstname_required'), 'surname.required' => __('validation.custom_messages.surname_required'), @@ -107,17 +107,17 @@ class UserController extends Controller 'email' => ['required', 'email', Rule::unique('users')->ignore($user->id),], 'phone' => 'required', - 'home_address' => 'required', - 'home_city' => 'required', - 'home_postcode' => 'required', - 'home_country' => 'required', - 'home_state' => 'required', + 'home_address' => 'required_with:home_city,home_postcode,home_country,home_state', + 'home_city' => 'required_with:home_address,home_postcode,home_country,home_state', + 'home_postcode' => 'required_with:home_address,home_city,home_country,home_state', + 'home_country' => 'required_with:home_address,home_city,home_postcode,home_state', + 'home_state' => 'required_with:home_address,home_city,home_postcode,home_country', - 'billing_address' => 'required', - 'billing_city' => 'required', - 'billing_postcode' => 'required', - 'billing_country' => 'required', - 'billing_state' => 'required', + 'billing_address' => 'required_with:billing_city,billing_postcode,billing_country,billing_state', + 'billing_city' => 'required_with:billing_address,billing_postcode,billing_country,billing_state', + 'billing_postcode' => 'required_with:billing_address,billing_city,billing_country,billing_state', + 'billing_country' => 'required_with:billing_address,billing_city,billing_postcode,billing_state', + 'billing_state' => 'required_with:billing_address,billing_city,billing_postcode,billing_country', ], [ 'firstname.required' => __('validation.custom_messages.firstname_required'), 'surname.required' => __('validation.custom_messages.surname_required'),