fix user creation validation

This commit is contained in:
2024-05-01 17:43:34 +10:00
parent ebf97a8242
commit 09bd9a22c9

View File

@@ -46,20 +46,20 @@ class UserController extends Controller
$request->validate([ $request->validate([
'firstname' => 'required', 'firstname' => 'required',
'surname' => 'required', 'surname' => 'required',
'email' => 'required|email|unique:users,email', 'email' => 'required|email',
'phone' => 'required', 'phone' => 'required',
'home_address' => 'required', 'home_address' => 'required_with:home_city,home_postcode,home_country,home_state',
'home_city' => 'required', 'home_city' => 'required_with:home_address,home_postcode,home_country,home_state',
'home_postcode' => 'required', 'home_postcode' => 'required_with:home_address,home_city,home_country,home_state',
'home_country' => 'required', 'home_country' => 'required_with:home_address,home_city,home_postcode,home_state',
'home_state' => 'required', 'home_state' => 'required_with:home_address,home_city,home_postcode,home_country',
'billing_address' => 'required', 'billing_address' => 'required_with:billing_city,billing_postcode,billing_country,billing_state',
'billing_city' => 'required', 'billing_city' => 'required_with:billing_address,billing_postcode,billing_country,billing_state',
'billing_postcode' => 'required', 'billing_postcode' => 'required_with:billing_address,billing_city,billing_country,billing_state',
'billing_country' => 'required', 'billing_country' => 'required_with:billing_address,billing_city,billing_postcode,billing_state',
'billing_state' => 'required', 'billing_state' => 'required_with:billing_address,billing_city,billing_postcode,billing_country',
], [ ], [
'firstname.required' => __('validation.custom_messages.firstname_required'), 'firstname.required' => __('validation.custom_messages.firstname_required'),
'surname.required' => __('validation.custom_messages.surname_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),], 'email' => ['required', 'email', Rule::unique('users')->ignore($user->id),],
'phone' => 'required', 'phone' => 'required',
'home_address' => 'required', 'home_address' => 'required_with:home_city,home_postcode,home_country,home_state',
'home_city' => 'required', 'home_city' => 'required_with:home_address,home_postcode,home_country,home_state',
'home_postcode' => 'required', 'home_postcode' => 'required_with:home_address,home_city,home_country,home_state',
'home_country' => 'required', 'home_country' => 'required_with:home_address,home_city,home_postcode,home_state',
'home_state' => 'required', 'home_state' => 'required_with:home_address,home_city,home_postcode,home_country',
'billing_address' => 'required', 'billing_address' => 'required_with:billing_city,billing_postcode,billing_country,billing_state',
'billing_city' => 'required', 'billing_city' => 'required_with:billing_address,billing_postcode,billing_country,billing_state',
'billing_postcode' => 'required', 'billing_postcode' => 'required_with:billing_address,billing_city,billing_country,billing_state',
'billing_country' => 'required', 'billing_country' => 'required_with:billing_address,billing_city,billing_postcode,billing_state',
'billing_state' => 'required', 'billing_state' => 'required_with:billing_address,billing_city,billing_postcode,billing_country',
], [ ], [
'firstname.required' => __('validation.custom_messages.firstname_required'), 'firstname.required' => __('validation.custom_messages.firstname_required'),
'surname.required' => __('validation.custom_messages.surname_required'), 'surname.required' => __('validation.custom_messages.surname_required'),