Skip to content

Commit

Permalink
Added default value for id prop.
Browse files Browse the repository at this point in the history
  • Loading branch information
victorybiz committed Nov 12, 2021
1 parent e4a2035 commit 3b91620
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/SimpleSelect.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ class SimpleSelect extends Component
* @return void
*/
public function __construct(
array $options,
string $id,
string $name,
array $options = [],
string $id = null,
string $name = null,
$valueField = 'value',
$textField = 'text' ,
$value = null ,
Expand All @@ -57,6 +57,13 @@ public function __construct(
$this->maxSelection = $maxSelection;
$this->searchable = $searchable;
$this->clearable = $clearable;

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

/**
Expand Down

0 comments on commit 3b91620

Please sign in to comment.