Creating Once Props
To create a once prop, use theInertia::once() method when returning your response. This method receives a callback that returns the prop data.
Forcing a Refresh
You may force a once prop to be refreshed using thefresh() method.
Refreshing from the Client
You may refresh a once prop from the client-side using a partial reload. The server will always resolve a once prop when explicitly requested.Expiration
You may set an expiration time using theuntil() method. This method accepts a DateTimeInterface, DateInterval, or an integer (seconds). The prop will be refreshed on a subsequent visit after the expiration time has passed.
Custom Keys
You may assign a custom key to the prop using theas() method. This is useful when you want to share data across multiple pages while using different prop names.
Sharing Once Props
You may share once props globally using theInertia::share() method.
shareOnce() method.
as(), fresh(), and until() onto the shareOnce method.
shareOnce() method in your middleware. The middleware will evaluate both share() and shareOnce(), merging the results.
Prefetching
Once props are compatible with prefetching. The client automatically includes any remembered once props in prefetched responses, so navigating to a prefetched page will already have the once props available. Prefetched pages containing an expired once prop will be invalidated from the cache.Combining with Other Prop Types
Theonce() modifier may be chained onto deferred, merge, and optional props.