Skip to content

Commit 0e756d1

Browse files
committed
Fix In leads
1 parent 9c9d4ba commit 0e756d1

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

packages/Webkul/Admin/src/Http/Requests/LeadForm.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public function rules()
119119
request($field)
120120
)
121121
) {
122-
$fail('The value has already been taken.');
122+
\Illuminate\Support\Facades\Validator::make([], [])->errors()->add($field, 'The value has already been taken.');
123123
}
124124
});
125125
}

packages/Webkul/Admin/src/Resources/views/quotes/create.blade.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ class="flex flex-col gap-4"
190190
<x-admin::attributes
191191
:custom-attributes="app('Webkul\Attribute\Repositories\AttributeRepository')->findWhere([
192192
'entity_type' => 'quotes',
193-
['code', 'NOTIN', ['subject', 'description', 'expired_at', 'user_id', 'person_id','billing_address', 'shipping_address']],
193+
'is_user_defined' => 1,
194194
])->sortBy('sort_order')"
195195
:custom-validations="[
196196
'expired_at' => [

packages/Webkul/Contact/src/Repositories/PersonRepository.php

+6
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ public function create(array $data)
7474
$data['user_id'] = $data['user_id'] ?: null;
7575
}
7676

77+
$existingPerson = parent::whereRaw("JSON_EXTRACT(emails, '$[0].value') = ?", [$data['emails'][0]['value']])->first();
78+
79+
if ($existingPerson) {
80+
return $existingPerson;
81+
}
82+
7783
$person = parent::create($data);
7884

7985
$this->attributeValueRepository->save(array_merge($data, [

0 commit comments

Comments
 (0)