Skip to content

Commit f76a53d

Browse files
authored
Use Request ParameterBag
1 parent d2326e3 commit f76a53d

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/Support/Html/Mixins/HtmlExtendedMixin.php

+3-6
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,12 @@
88
use Spatie\Html\Elements\Form;
99
use stdClass;
1010

11-
#[\AllowDynamicProperties]
1211
class HtmlExtendedMixin extends stdClass
1312
{
14-
protected ?Livewire $form = null;
15-
1613
public function wireForm(): mixed
1714
{
1815
return function (Livewire $form, ?string $action = null): Form {
19-
$this->form = $form;
16+
$this->request->attributes->set('form', $form);
2017

2118
return Form::create()
2219
->attributeIf($action, 'wire:submit', $action);
@@ -26,7 +23,7 @@ public function wireForm(): mixed
2623
public function closeWireForm(): mixed
2724
{
2825
return function (): Form {
29-
$this->form = null;
26+
$this->request->attributes->remove('form');
3027

3128
return Form::create()->close();
3229
};
@@ -35,7 +32,7 @@ public function closeWireForm(): mixed
3532
public function error(): mixed
3633
{
3734
return function (string $field, ?string $message = null, ?string $format = null): Validate {
38-
$messageBag = $this->form?->getComponent()->getErrorBag();
35+
$messageBag = $this->request->get('form')?->getComponent()->getErrorBag();
3936

4037
$hasMessage = $messageBag?->has($field) ?? false;
4138

0 commit comments

Comments
 (0)