Level 3
Try returning
Response::JSON(array('foo'=>'bar'));
Can you tell me why this piece fo code, placed in controller:
$model = \App\Model::first();
return response()->json($model->toArray());
gives a wrong header: Content-Type: text/html; charset=UTF-8
while this code:
$model = \App\Model::first();
header('Content-Type: application/json; charset=utf-8');
echo json_encode($model->toArray());
exit;
gives a proper header: Content-Type: application/json; charset=utf-8
Please or to participate in this conversation.