#### Laravel 支持直接返回数组或者模型(或者集合),以下两种方式最终会被自动转为 json 响应:
~~~
// 直接返回数组
Route::get('/request-json-array', function(){
$array = array('foo', 'bar');
//this route should returns json response
return $array;
});
// 或者返回模型/集合
Route::get('/request-json-model', function(){
//if 'User' is an eloquent model, this route should returns json response
return User::all();
});
~~~