We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 444163e commit 3b4442eCopy full SHA for 3b4442e
app/Rules/ShippingPlaceValidation.php
@@ -84,7 +84,7 @@ private function address(Closure $fail): void
84
{
85
$validator = Validator::make($this->data, [
86
'shipping_place' => ['nullable', 'array', new ShippingAddressRequired()],
87
- 'shipping_place.name' => ['string', 'max:255', new FullName()],
+ 'shipping_place.name' => ['string', 'max:255'],
88
'shipping_place.phone' => ['string', 'max:20'],
89
'shipping_place.address' => ['string', 'max:255'],
90
'shipping_place.zip' => ['string', 'max:16'],
@@ -93,6 +93,10 @@ private function address(Closure $fail): void
93
'shipping_place.vat' => ['nullable', 'string', 'max:15'],
94
]);
95
96
+ $validator->sometimes('shipping_place.name', [new FullName()], function ($input) {
97
+ return !isset($input->shipping_place['vat']) || $input->shipping_place['vat'] === null;
98
+ });
99
+
100
if ($validator->fails()) {
101
foreach ($validator->errors()->messages() as $attribute => $messages) {
102
foreach ($messages as $message) {
0 commit comments