Skip to content

Commit

Permalink
Add id parameter (default true)
Browse files Browse the repository at this point in the history
  • Loading branch information
francoism90 authored Oct 21, 2024
1 parent 3ec6547 commit 7b39ece
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Support/Html/Mixins/BaseElementMixin.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,15 @@ public function wireKey(): mixed

public function wireModel(): mixed
{
return function (string $key, ?string $modifiers = null) {
return function (string $key, ?string $modifiers = null, bool $id = true) {
/** @var BaseElement $this */
$attribute = str('wire:model')
->when($modifiers, fn (Stringable $str) => $str->append(".{$modifiers}"))
->squish();

return $this->attribute($attribute->value(), $key);
return $this

Check failure on line 45 in src/Support/Html/Mixins/BaseElementMixin.php

View workflow job for this annotation

GitHub Actions / phpstan

Call to an undefined method Spatie\Html\BaseElement::attributeIf().

Check failure on line 45 in src/Support/Html/Mixins/BaseElementMixin.php

View workflow job for this annotation

GitHub Actions / phpstan

Call to an undefined method Spatie\Html\BaseElement::attributeIf().
->attribute($attribute->value(), $key)
->attributeIf($id, 'id', $key);
};
}
}

0 comments on commit 7b39ece

Please sign in to comment.