【发布时间】:2022-01-18 09:41:54
【问题描述】:
所以我在这里遇到了一些问题,我的输出数据上没有显示链接,我尝试过这样的查询:
$getData = Inventory::select('id_inventory', 'inventory_code', 'inventory_id_location', 'inventory_id_category', 'date_of_buy', 'price_of_item', 'condition_of_item', 'description', 'created_by', 'edited_by')
->selectRaw('group_concat(inventory_id_category) as inventory_id_categories')
->selectRaw('group_concat(id_inventory) as id_inventories')
->with(['categories' => function ($query) {
$query->select('id_category', 'category_code', 'category_name');
}])
->with(['locations' => function ($query) {
$query->select('id_location', 'location_name');
}])
->with(['delivery_inventories' => function ($query) {
$query->select('id_delivery', 'delivery_id_inventory', 'delivery_id_location', 'delivery_date', 'deliver_by', 'description')
->with(['location_deliveries' => function ($query) {
$query->select('id_location', 'location_name');
}]);
}])
->whereHas('categories', function ($query) use ($search) {
$query->orWhere('category_code', 'like', "%{$search}%")
->orWhere('category_name', 'like', "%{$search}%");
})
->whereHas('locations', function ($query) use ($search) {
$query->orWhere('location_name', 'like', "%{$search}%");
})
->whereHas('delivery_inventories', function ($query) use ($search) {
$query->orWhere('delivery_date', 'like', "%{$search}%")
->orWhere('deliver_by', 'like', "%{$search}%")
->orWhere('description', 'like', "%{$search}%");
})
->where('inventory_code', 'like', "%{$search}%")
->orWhere('price_of_item', 'like', "%{$search}%")
->orWhere('condition_of_item', 'like', "%{$search}%")
->orWhere('description', 'like', "%{$search}%")
->groupBy('inventory_code')
->orderBy('inventory_code')
->paginate(10);
return response()->json([
'get_data' => $getData
], 200);
但在我的控制台上,结果如下:
我想问任何错误或未完成的查询,所以我的链接不会显示在我的控制台上?有什么建议吗?谢谢。
我之前的项目(但我不能在我当前的项目中使用它):
【问题讨论】:
-
next_page_url和last_page_url看起来像是指向我的分页链接。我错过了什么吗? -
分页所需的任何信息都在此 JSON 中 - 根据该信息构建您的分页。 JSON中不会有“Prev”、“Next”、1,2,3...链接
-
@apokryfos,我已经更新了我的问题,希望我的问题有更清晰的解释
-
@brombeer,在我以前的项目中没有先生,我可以使用链接,但现在我不能使用它
-
看起来
links是在 Laravel 8.0.3 中添加的,所以这个项目可能更旧?
标签: laravel pagination