You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -20,6 +18,9 @@ Laravel Precognition allows you to anticipate the outcome of a future HTTP reque
20
18
21
19
When Laravel receives a "precognitive request", it will execute all of the route's middleware and resolve the route's controller dependencies, including validating [form requests](/docs/{{version}}/validation#form-request-validation) - but it will not actually execute the route's controller method.
22
20
21
+
> [!NOTE]
22
+
> As of Inertia 2.3, Precognition support is built-in. Please consult the [Inertia Forms documentation](https://inertiajs.com/docs/v2/the-basics/forms) for more information. Earlier Inertia versions require Precognition 0.x.
23
+
23
24
<aname="live-validation"></a>
24
25
## Live Validation
25
26
@@ -187,38 +188,6 @@ You may determine if a form submission request is in-flight by inspecting the fo
187
188
</button>
188
189
```
189
190
190
-
<aname="using-vue-and-inertia"></a>
191
-
### Using Vue and Inertia
192
-
193
-
> [!NOTE]
194
-
> If you would like a head start when developing your Laravel application with Vue and Inertia, consider using one of our [starter kits](/docs/{{version}}/starter-kits). Laravel's starter kits provide backend and frontend authentication scaffolding for your new Laravel application.
195
-
196
-
Before using Precognition with Vue and Inertia, be sure to review our general documentation on [using Precognition with Vue](#using-vue). When using Vue with Inertia, you will need to install the Inertia compatible Precognition library via NPM:
197
-
198
-
```shell
199
-
npm install laravel-precognition-vue-inertia
200
-
```
201
-
202
-
Once installed, Precognition's `useForm` function will return an Inertia [form helper](https://inertiajs.com/forms#form-helper) augmented with the validation features discussed above.
203
-
204
-
The form helper's `submit` method has been streamlined, removing the need to specify the HTTP method or URL. Instead, you may pass Inertia's [visit options](https://inertiajs.com/manual-visits) as the first and only argument. In addition, the `submit` method does not return a Promise as seen in the Vue example above. Instead, you may provide any of Inertia's supported [event callbacks](https://inertiajs.com/manual-visits#event-callbacks) in the visit options given to the `submit` method:
205
-
206
-
```vue
207
-
<script setup>
208
-
import { useForm } from 'laravel-precognition-vue-inertia';
209
-
210
-
const form = useForm('post', '/users', {
211
-
name: '',
212
-
email: '',
213
-
});
214
-
215
-
const submit = () => form.submit({
216
-
preserveScroll: true,
217
-
onSuccess: () => form.reset(),
218
-
});
219
-
</script>
220
-
```
221
-
222
191
<aname="using-react"></a>
223
192
### Using React
224
193
@@ -378,40 +347,6 @@ You may determine if a form submission request is in-flight by inspecting the fo
378
347
</button>
379
348
```
380
349
381
-
<aname="using-react-and-inertia"></a>
382
-
### Using React and Inertia
383
-
384
-
> [!NOTE]
385
-
> If you would like a head start when developing your Laravel application with React and Inertia, consider using one of our [starter kits](/docs/{{version}}/starter-kits). Laravel's starter kits provide backend and frontend authentication scaffolding for your new Laravel application.
386
-
387
-
Before using Precognition with React and Inertia, be sure to review our general documentation on [using Precognition with React](#using-react). When using React with Inertia, you will need to install the Inertia compatible Precognition library via NPM:
388
-
389
-
```shell
390
-
npm install laravel-precognition-react-inertia
391
-
```
392
-
393
-
Once installed, Precognition's `useForm` function will return an Inertia [form helper](https://inertiajs.com/forms#form-helper) augmented with the validation features discussed above.
394
-
395
-
The form helper's `submit` method has been streamlined, removing the need to specify the HTTP method or URL. Instead, you may pass Inertia's [visit options](https://inertiajs.com/manual-visits) as the first and only argument. In addition, the `submit` method does not return a Promise as seen in the React example above. Instead, you may provide any of Inertia's supported [event callbacks](https://inertiajs.com/manual-visits#event-callbacks) in the visit options given to the `submit` method:
> The Inertia flavored Precognition libraries will only use the configured Axios instance for validation requests. Form submissions will always be sent by Inertia.
0 commit comments