Breaking Change From 5.1 -> 5.2
- Dominant language
- PHP
- Stars
- 9.4k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
Description
Hello,
I've scoured both the Laravel upgrade docs and dingo docs for a solution here but I can't seem to find one. On laravel 5.1.\* this block of code returns an array of JSON objects:
``` php
public function index($account)
{
if(Auth::user()->accounts->contains($account))
{
$drones = $account->drones()->where('retired',false)->get()->sortBy('total_flight_time');
$drones = $drones->reverse();
return $drones;
}
}
```
Returns:
```
{
"drones": [
{
"id": 21,
.....
},
{
"id": 26,
......
}
]
}
```
However, when I upgrade to Laravel 5.2 I get the following unexpected result:
```
{
"drones": {
"0": {
"id": 21,
....
},
"2": {
"id": 26,
.....
}
}
}
```
Can you point me to anywhere that might explain what's breaking this and how I can keep my API consistent while moving to 5.2? I can't afford breaking changes at the moment.
Thanks
Josh
Contributor guide
Assessment
This issue has not been assessed yet.