I hope you can help me with this.
I used:
- Mysql workbench 5.6 with ( 'charset' => 'utf8mb4', 'collation' => 'utf8mb4_unicode_ci', )
- Laravel 5.4
I have a controller (GetDataController.php)that will call stored procedure, below is the code:
function getData(){
$data= DB::select('call spGetAllData()');
return Response::json(['message' => $data], 200);
}
api.php
Route::get('showAllData','GetDataController@getData)
The result after accessing it via browser:
���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������{"message":[{"ID":1,"Data":"data001"},{"ID":2,"Data":"data002"},{"ID":3,"Data":"data003"}]}
Tried using utf8_encode(),json_decode/encode but still no luck.
EDIT FOR dd($data) result;
array:3 [▼
0 => {#221 ▼
+"ID": 1
+"Data": "data001"
}
1 => {#224 ▼
+"ID": 2
+"Data": "data002"
}
2 => {#226 ▼
+"ID": 3
+"Data": "data003"
}
]