Laravel 201 Created JSON With Location Header
Each API seems to be different. However, there are some best practices that we should all try to follow.
One of those that I really like is the 201 Created HTTP response. If the object is created immediately, you may even return the full object contents.
In some cases, we don’t have the data or don’t want to return the full payload. We can return null with a location header. Here’s how to do that with Laravel.