Use Conventional Forms with Wayfinder
mainTo use Wayfinder for HTML form attributes, you must first opt-in during generation:
php artisan wayfinder:generate --with-formThen, use the .form() method to generate attributes for <form> elements.
Basic Form
import { store } from "@/actions/App/Http/Controllers/PostController";
<form {...store.form()} />
// Results in: <form action="/posts" method="post">Forms with Parameters and Method Spoofing
For routes requiring parameters or method spoofing (like PATCH or PUT):
import { update } from "@/actions/App/Http/Controllers/PostController";
<form {...update.form(1)} />
// Results in: <form action="/posts/1?_method=PATCH" method="post">Specifying a Method
You can explicitly specify the method on the form helper:
<form {...update.form.put(1)} />