Skip to content

Commit

Permalink
Added default value for id props.
Browse files Browse the repository at this point in the history
  • Loading branch information
victorybiz committed Nov 12, 2021
1 parent 9c4e52e commit 4266765
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 2,14 @@

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

## v1.1.6 - 2021-11-12

- Added default value for `id` props.

## v1.1.5 - 2021-09-28

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

- Fix utilsScript relative path bug
Expand Down
9 changes: 8 additions & 1 deletion src/LaravelTelInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 14,17 @@ class LaravelTelInput extends Component
*
* @return void
*/
public function __construct(string $id, string $name = 'phone')
public function __construct(string $id = null, string $name = 'phone')
{
$this->id = $id;
$this->name = $name;

if (!$this->name) {
$this->name = 'phone-' . uniqid();
}
if (!$this->id) {
$this->id = $this->name;
}
}

/**
Expand Down

0 comments on commit 4266765

Please sign in to comment.