Skip to content

Commit 4266765

Browse files
committed
Added default value for id props.
1 parent 9c4e52e commit 4266765

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@
22

33
All notable changes to `laravel-tel-input` will be documented in this file
44

5+
## v1.1.6 - 2021-11-12
6+
7+
- Added default value for `id` props.
8+
59
## v1.1.5 - 2021-09-28
610

711
- Fix tel-input not rendering in Livewire after component update, refresh or change in DOM content.
8-
-
12+
913
## v1.1.4 - 2021-09-27
1014

1115
- Fix utilsScript relative path bug

src/LaravelTelInput.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,17 @@ class LaravelTelInput extends Component
1414
*
1515
* @return void
1616
*/
17-
public function __construct(string $id, string $name = 'phone')
17+
public function __construct(string $id = null, string $name = 'phone')
1818
{
1919
$this->id = $id;
2020
$this->name = $name;
21+
22+
if (!$this->name) {
23+
$this->name = 'phone-' . uniqid();
24+
}
25+
if (!$this->id) {
26+
$this->id = $this->name;
27+
}
2128
}
2229

2330
/**

0 commit comments

Comments
 (0)