Skip to content

Commit

Permalink
Merge pull request #675 from santigarcor/patch-1
Browse files Browse the repository at this point in the history
Update wrapping.md to clarify collections and paginated collections case
  • Loading branch information
rubenvanassche authored Mar 4, 2024
2 parents d4a52d7 + 1e72acb commit 6e20d6f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/as-a-resource/wrapping.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Or you can set a global wrap key inside the `data.php` config file:
Collections can be wrapped just like data objects:

```php
SongData::collect(Song::all())->wrap('data');
SongData::collect(Song::all(), DataCollection::class)->wrap('data');
```

The JSON will now look like this:
Expand All @@ -84,7 +84,7 @@ The JSON will now look like this:
It is possible to set the data key in paginated collections:

```php
SongData::collect(Song::paginate())->wrap('paginated_data');
SongData::collect(Song::paginate(), PaginatedDataCollection::class)->wrap('paginated_data');
```

Which will let the JSON look like this:
Expand Down

0 comments on commit 6e20d6f

Please sign in to comment.