Skip to content

Commit f28303f

Browse files
committed
updte documentation
1 parent b86dfd4 commit f28303f

1 file changed

Lines changed: 16 additions & 9 deletions

File tree

forge-wire.html

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ <h2 class="text-2xl font-bold text-gray-900 mb-4">Overview</h2>
158158
</p>
159159

160160
<div class="bg-blue-50 border border-blue-200 rounded-lg p-6 mb-6">
161-
<h2 class="font-semibold text-lg mb-4 text-blue-900">Livewire Power, Standard Controller
161+
<h2 class="font-semibold text-lg mb-4 text-blue-900">ForgeWire Power, Standard Controller
162162
Simplicity</h2>
163163
<div class="grid md:grid-cols-2 gap-4">
164164
<div class="space-y-2">
@@ -380,7 +380,7 @@ <h3 class="text-lg font-semibold mb-3">Calling Actions from Frontend</h3>
380380
<div class="code-block p-6 text-white rounded-lg mb-6">
381381
<pre><code class="language-html">&lt;!-- fw:click --&gt;
382382
&lt;button fw:click="increment"&gt;+&lt;/button&gt;
383-
&lt;button fw:click="update(5, 'New Name')"&gt;Update&lt;/button&gt;
383+
&lt;button fw:click="update" fw:param-id="5" fw:param-name="New Name"&gt;Update&lt;/button&gt;
384384

385385
&lt;!-- fw:submit --&gt;
386386
&lt;form fw:submit="save"&gt;
@@ -448,8 +448,8 @@ <h2 class="text-2xl font-bold text-gray-900 mb-4">Frontend Integration</h2>
448448

449449
<h3 class="text-lg font-semibold mb-3">Directives Reference</h3>
450450
<ul class="list-disc list-inside space-y-2 text-gray-600 mb-4">
451-
<li><code class="bg-gray-100 px-2 py-1 rounded">fw:click="method"</code> — Call action on
452-
click</li>
451+
<li><code class="bg-gray-100 px-2 py-1 rounded">fw:click="save"</code> — Call action on
452+
click (use <code>fw:param-*</code> for arguments)</li>
453453
<li><code class="bg-gray-100 px-2 py-1 rounded">fw:model="property"</code> — Two-way
454454
binding (immediate)</li>
455455
<li><code class="bg-gray-100 px-2 py-1 rounded">fw:model.lazy</code> — Update on
@@ -458,8 +458,8 @@ <h3 class="text-lg font-semibold mb-3">Directives Reference</h3>
458458
updates (600ms default)</li>
459459
<li><code class="bg-gray-100 px-2 py-1 rounded">fw:model.debounce.300ms</code> — Custom
460460
debounce time</li>
461-
<li><code class="bg-gray-100 px-2 py-1 rounded">fw:submit="method"</code> — Form
462-
submission</li>
461+
<li><code class="bg-gray-100 px-2 py-1 rounded">fw:submit="save"</code> — Form
462+
submission (auto-prevents refresh)</li>
463463
<li><code class="bg-gray-100 px-2 py-1 rounded">fw:poll</code> — Auto-refresh every 2
464464
seconds</li>
465465
<li><code class="bg-gray-100 px-2 py-1 rounded">fw:poll.5s</code> — Custom poll interval
@@ -652,14 +652,21 @@ <h2 class="text-2xl font-bold text-gray-900 mb-4">Usage Examples</h2>
652652

653653
<h3 class="text-lg font-semibold mb-3">Simple Counter</h3>
654654
<div class="code-block p-6 text-white rounded-lg mb-6">
655-
<pre><code class="language-php">final class Counter extends WireComponent
655+
<pre><code class="language-php">#[Reactive]
656+
final class CounterController
656657
{
658+
use ControllerHelper;
659+
657660
#[State]
658661
public int $count = 0;
659662

660-
public function mount(array $props = []): void
663+
#[Route("/counter")]
664+
public function index(): Response
661665
{
662-
$this->count = (int)($props['start'] ?? 0);
666+
return $this->view('pages/counter', [
667+
'count' => $this->count,
668+
'parity' => $this->count % 2 ? 'odd' : 'even',
669+
]);
663670
}
664671

665672
#[Action]

0 commit comments

Comments
 (0)