我想从我的JSON输出中移除一些元素。
我的当前输出是:
[
{
"current_page": 1,
"data": [
{
"_id": "6580f69587f0f77a14091c22",
"email": "janzboy@gmail.com",
"first_name": "Janz",
"last_name": "Boy",
"password": "1995"
}
],
"first_page_url": "http://localhost:8000/api/customer?page=1"
}
]
我想要一个更简洁的输出,如下所示:
[
{
"_id": "6580f69587f0f77a14091c22",
"email": "janzboy@gmail.com",
"first_name": "Janz",
"last_name": "Boy",
"password": "1995"
}
]
这是我的控制器代码:
class CustomerController extends Controller
{
public function index()
{
$customers = Customer::paginate(10);
return response()->json([
'data' => $customers
]);
}
}
请帮个忙,兄弟。