I see two different id's and two different bed_ids.
Also Laravel/lumen returns Json with out the need to specify it.
Return Bed::all() is the same as you have.
I'm using Lumen to make a simple API. I have the following action in my controller:
public function index()
{
$beds = Bed::all();
return response()->json($beds);
}
This is the json result:
[
{
"0": 2,
"1": 2000001,
"2": 3,
"3": "2016-02-02 21:43:58",
"4": "2016-02-02 21:43:58",
"id": 2,
"bed_id": 2000001,
"status_id": 3,
"created_at": "2016-02-02 21:43:58",
"updated_at": "2016-02-02 21:43:58"
},
{
"0": 3,
"1": 2000002,
"2": 4,
"3": "2016-02-02 21:43:58",
"4": "2016-02-02 21:43:58",
"id": 3,
"bed_id": 2000002,
"status_id": 4,
"created_at": "2016-02-02 21:43:58",
"updated_at": "2016-02-02 21:43:58"
}
]
I have no idea why the results are duplicates. Does anyone have?
Please or to participate in this conversation.