Skip to content

Commit

Permalink
docs: note about using lazy collections
Browse files Browse the repository at this point in the history
  • Loading branch information
Travis CI committed Oct 31, 2021
1 parent 403f6f4 commit ec24485
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ class ProductController extends Controller
}
```

Please use lazy collections when you can. During testing, using `Product::lazy()` to export 10,000 products took about 2MB of memory, compared to 44 MB of memory using `Product::all()`. Both exports took the same amount of time (around 45 seconds).

## Step 3: Exporting a response

In order to retrieve an API response as CSV instead of JSON, send a request to your API with the `Accept` header set to `text/csv`.
Expand Down

0 comments on commit ec24485

Please sign in to comment.