Laravel Pro Tips
#responses #cheatsheet
β‘οΈA Laravel Response #cheatsheet π₯π₯ Some of the available methods on Laravel's response helper. π€ #laravel #php
Aaron Lumsden π | Indie Hacker Dev
#responses
When you don't have anything to return in the response of any request you can simply return the response with noContent() method in #Laravel. See how can you do that π #PHP #HTTP #webdevelopers #100DaysOfCode #developers #100Devs
Mohammad Haris β‘
#responses #exceptions
πΆοΈ #Laravel Tip: I like to use the helper functions `abort`, `abort_if`, `abort_unless` to throw HTTP Exceptions. There is also `throw_if` and `throw_unless` to throw a RuntimeException in your code. #PHP #Developers #100Devs
Bilal Haidar
#routes #responses #redirects
π₯ #Laravel Tip: Version 9 introduces the βto_routeβ global helper method to simplify returning a redirect to a route. Will you make use of it, or do you prefer the previous way:
Matt Kingshott
#responses #cache #http
Handling HTTP caching is a little tricky in #Laravel because it's can be a two-step process (eg. on pages that need to make lots of external API/database calls). Here's a basic example. I've got another package in the works that will make it much easier! https://t.co/tuuwtNH3IL
Chris #BlackLivesMatter
#responses #redirects
#Laravel tip: Sometimes, you'll want to redirect to a certain URL when specified and fallback to the previous URL otherwise. You can use the `url()->previous()` method to keep your code concise π
Luke Downing
#downloads #responses
π₯ #Laravel Tip: When you want to send the user a file that their browser natively supports e.g. an image or a PDF, send them a file response instead of a download. That way, the browser will display it for them.
#responses #macros
π₯ You can create custom @laravelphp Response macros for common tasks, such as returning an image response, returning API responses, etc. There are many additional places within Laravel where you can make use of macros!
Marcel Pociot π§ͺ
No articles were found.