What's New in Laravel 12.54: Request Intervals, Better Dumps & Selective Relation Unloading
Chapters5
Introduces a new interval helper on the request object to pass duration into carbon interval instances and shows its usage in creating a reminder.
Laravel 12.54 adds a new request interval helper, improved HTTP dump details, and a selective relation unloading feature for cleaner models.
Summary
Ryan (Laravel) showcases three practical enhancements in Laravel 12.54. First, a new request interval helper lets you pass durations directly into CarbonInterval instances, making time-based logic cleaner and more flexible in controllers and tests. He walks through storing a reminder with a duration like 30 minutes and demonstrates how the request can cast and interpret that duration in several formats. Second, the HTTP client dump now reveals the method, URL, and status code alongside the response body, improving debugging clarity when you inspect responses. Finally, Laravel introduces withoutRelation and withoutRelation (plural) features to unload or clone specific relationships on a model without mutating the original instance, enabling cleaner data payloads when you need to remove or retain certain relations on demand. Sunder and others across the Laravel team are highlighted for contributions, and a warm reminder to like and subscribe wraps up the walkthrough.
Key Takeaways
- A new request interval helper enables passing a duration directly into CarbonInterval, with minutes handling and unit flexibility (e.g., minute or minutes).
- Test coverage confirms that 30 minutes added to the current time yields the expected reminder timestamp, and the feature accepts string or integer inputs as well as a date-based interval.
- HTTP client dump now shows the request method, URL, and status code along with the response body, improving debugging visibility in Laravel 12.54.
- The new withoutRelation method allows loading a model with relations and then returning a version without specific relationships, using a clone to avoid mutating the original model.
- A dedicated withoutRelation (singular) method supports removing a single relation (e.g., comments) while keeping the rest of the model intact.
- The update emphasizes non-mutating behavior when unloading relations, preserving the original model for later use.
- Contributors, including Sunder, are recognized for ongoing improvements to Laravel.
Who Is This For?
Laravel developers who want smarter debugging tools, cleaner model payloads, and smoother time handling in controllers. Especially useful for those integrating CarbonInterval logic, refining API responses, and selectively loading/unloading model relations.
Notable Quotes
"The only thing that we're passing here to the minutes method is the request."
—Demonstrating how the new request interval helper integrates with current request casting.
"Now we can directly run the interval method on the request like we cannot already do with the string integer or dates which is super powerful."
—Showcasing the immediate usability of the new interval method on the request object.
"This also works with intervals."
—Highlighting the flexibility of input types for interval handling.
"We can now selectively unload the relations from a model without mutating it using the new without relation method."
—Introducing the core feature for non-mutating relation removal.
"The data comes with the request method, URL and status code alongside the response body in the dump."
—Explaining the enhanced HTTP client dump output for debugging.
Questions This Video Answers
- How does the new request interval helper in Laravel 12.54 work with CarbonInterval?
- What changes does the Laravel 12.54 HTTP client dump introduce for debugging HTTP responses?
- How can I unload or clone model relations in Laravel without mutating the original model?
- What are the differences between withoutRelation and withoutRelation (singular) in Laravel?
- Can I pass 30 minutes as a duration to a Laravel controller and have it correctly interpreted by CarbonInterval?
Laravel 12.54CarbonIntervalRequest interval helperLaravel HTTP client dumpwithoutRelationwithoutRelation(s)Model relations unloadingTests in LaravelSunderLaravel debugging tools
Full Transcript
Hello Laval friends. Today we're looking at Laval version 12.54 which is all about better debugging and smarter helpers. Let's go. [music] First up, we got a new interval helper on the request object that lets you pass duration into carbon interval instances. Inside this controller, this is a reminder controller to store a new reminder in the database. We have a title for the reminder and the duration. And we are passing the duration to a carbon interval because it's very nice to work with. And the only thing that we're passing here to the minutes method is the request.
And then we're passing the duration to an integer with one of the methods that we already have on the request for casting things. And then we're just creating here a new reminder, setting the title, and then adding the interval to the current time, which is yeah, very nice to use. And we also have a test for this. Let's take a look at the test. Um we're freezing the time here to make sure that we can work with um times. Here we have the reminders endpoint where we send some data in this case 30 minutes as a duration.
And then we're getting the only reminder back from the database and making sure that the title is correct and to equal when we add 30 minutes now to the current time. And again this is working. Also, what's really cool here is if we would change this to a string, this is also working. But also, if we would change this to 30 minutes, this would also still work. So, the carbon is very smart about what you pass in here. So, everything good so far, but now we have something new in level that we can use. And we just copy this out here.
And instead of passing here the interval which we don't have anymore, we are using now the new interval method on the request object itself which is really handy. And the second argument is the unit which in our case is minute or minutes. Both work here. Let's try to run our test. You can see it's still green. It's still passing. But now we can directly directly run the interval method on the request like we cannot already do with the string integer or dates which is super powerful. And now thanks to this addition this also works with intervals.
Thank you S. Next HTTP client dump method now shows the request method URL and status code alongside the response body. In level when you use an HTTP client to make a get request you get the response object back with all information about this response. But we also have in level is this dump method which just dumps out the response here which you can see with the data. But what is new now in the top you will also see where this data comes from which before wasn't that clear but now you can see it was a get request to this endpoint here and you also see the status code which is really helpful for debugging.
Thank you S again. And finally, we can now selectively unload the relations from a model without mutating it using the new without relation method. So in this um example, in this demo application, we have posts. So let's grab the first one here. First post. Here we go. Okay, cool. Now let's say we want to get the post with relations. We can do this with the with method with comments in this case is a relation that we have on this post. Let's run this. And fair enough, we get back the post with comments in the response.
Okay, cool. Now what we can do is we can also remove comments again. So on the post we are saying without relations. And now we get back our post model without relations. Perfect. And what's cool about this if we now let's say return the post here later, we have our post again with relations inside it. And this is cool for example if you think about you have an action on controller where you need to load all um the post with all the relations then you need to do something specific just without one or two relations you can remove them and you still have your post object back.
So this means we have this here we're just creating a clone here and we're not mutating the first one which is cool. So, but there's also a method to unset a relation, a specific one. Um, just a single one. And let's just return this. And yeah, we get back the post without the comments relation. This is working. But what's not working anymore when we see the post has now been mutated. So, this means this method is going to mutate the post model. So, you can't use it with the relation still on the post model. Okay.
But now we have something new which is called without relation. And if we try this you can see now we get back at the end here. So this is what we're returning here. The model still has all the comments. This is using clone in order to create a new cloned object here. And now you still have them relations on the model which is sometimes very handy thanks to this new without relation method. Thank you, Sunder. Of course, again, thanks to all the other contributors as well, making Lava better with every release. If this was helpful, please hit the like and subscribe button and see you the next time.
Bye.
More from Laravel
Get daily recaps from
Laravel
AI-powered summaries delivered to your inbox. Save hours every week while staying fully informed.



