You change a product’s price. The save succeeds, then the confirmation page still displays the old price. The next day, the team also needs to pass twenty or so catalogue filters into a search. Laravel’s November 4 roundup covers two October changes that address those situations.
A search route with a request body
The router accepts Route::query() to declare a QUERY route. The method lets a read-only search carry structured criteria in its body. Laravel also includes QUERY in Route::any(). In the web group, the token check that protects against requests triggered by another site still applies. Check existing catch-all routes and the path from the browser to the application.
A confirmation page that shows the new price
A replica is a copy of the database used to share the load of reads. It may receive changes after a delay. The sticky option directs reads to the write connection during the request that performed the write. The new PreventStaleDatabaseReads middleware extends that protection to subsequent requests in the same session for two seconds by default, on the default connection. For a specific read, usingWritePdo() explicitly selects the write connection.
Two staging tests
- Send a structured search from your test client through the proxy and the web application firewall. Compare the response with equivalent filters. Check input validation, size limits and the behaviour of routes declared with
Route::any(). - In an isolated environment with a deliberately delayed replica, write a price and follow the redirect. Compare an immediate read in the same session with a read in another session. Check again after the window and measure the added read load on the writer.
If the business requires every session to see the new value immediately, design the read strategy around that requirement. The middleware addresses the path taken by the person who has just written the data. For separately indexed search, measure indexing lag as well.
Related reading · Laravel Scout et Meilisearch.