Laravel 12.26 Update: Enhanced React & Vue Integration and New Collection Features
The latest Laravel release (12.26.0) brings exciting improvements, particularly for developers using React and Vue.js.
Wayfinder Integration in Starter Kits
The Laravel React and Vue starter kits now include Wayfinder, a powerful tool that creates a type-safe bridge between your Laravel backend routes and your frontend applications. This ensures better code maintainability and reduces errors.
import { store, update } from "@/actions/App/Http/Controllers/PostController";
const Page = () => ( <form {...update.form.put(1)}> {/* <form action="/posts/1?_method=PUT" method="post"> /} {/ ... */} </form> );
New withHeartbeat()
Method for LazyCollection
For long-running tasks, a new withHeartbeat()
method has been added to LazyCollection
. This allows you to execute a callback at regular intervals, preventing issues such as indefinite lock holds.
$lock = Cache::lock('generate-reports', CarbonInterval::minutes(5));
$lock->acquire();
Reports::where('status', 'pending') ->lazy() ->withHeartbeat(CarbonInterval::minutes(4), $lock->reacquire(...)) ->each($this->generateReport(...));
$lock->release();
Enhanced JSON Handling with toPrettyJson()
A new toPrettyJson()
method has been added to various Laravel components (collections, models, etc.), providing a convenient way to format JSON output for better readability.
// Before
$collection = collect([1, 2, 3]);
$collection->toJson(JSON_PRETTY_PRINT);
// After $collection = collect([1, 2, 3]); $collection->toPrettyJson();
This update significantly enhances the developer experience, offering improvements in both Laravel's core functionality and its integration with popular JavaScript frameworks. For detailed release notes and a complete list of changes, check the official Laravel changelog.
Comments
Join Our Community
Sign up to share your thoughts, engage with others, and become part of our growing community.
No comments yet
Be the first to share your thoughts and start the conversation!