Laravel 5 Collections: Converting a Collection's Contents to JSON With toJson
The toJson method will return a JSON encoded version of the data stored within the collection instance. It internally does this by returning a call to PHP's json_encode function, passing in any $options that were supplied. Like the json_encode...