Skip to content

Commit

Permalink
[develop]:+ Reset example
Browse files Browse the repository at this point in the history
  • Loading branch information
wpoortman committed Nov 29, 2021
1 parent 30ae62f commit e6b40bc
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
11 changes: 10 additions & 1 deletion src/Magewire/Features/Reset.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,24 @@
* @method bool hasFoo()
* @method string|null getBar()
* @method bool hasBar()
* @method int|null getBoot()
* @method bool hasBoot()
*/
class Reset extends Component
{
public $foo;
public $bar;

public $boot;

public function boot()
{
$this->boot = random_int(0,999);
}

public function resetByProperty(string $property)
{
$this->reset([$property]);
$this->reset([$property], $property === 'boot');
}

public function resetAll()
Expand Down
10 changes: 10 additions & 0 deletions src/view/frontend/layout/magewire_features_index.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,16 @@
</argument>
</arguments>
</block>

<block name="dollar-wire"
template="Magewirephp_MagewireExamples::magewire/features/dollar-wire.phtml"
>
<arguments>
<argument name="magewire" xsi:type="object">
\Magewirephp\MagewireExamples\Magewire\Features\DollarWire
</argument>
</arguments>
</block>
</container>
</referenceContainer>
</body>
Expand Down
2 changes: 1 addition & 1 deletion src/view/frontend/templates/magewire/features/reset.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ $magewire = $block->getMagewire();

<button type="button"
wire:click="resetAll"
class="btn btn-primary text-center text-sm"
class="btn btn-primary text-center text-sm mt-6"
>
Reset
</button>
Expand Down

0 comments on commit e6b40bc

Please sign in to comment.