优化商品浏览历史
parent
1b5152d0e8
commit
a0434c054f
|
|
@ -21,8 +21,8 @@ class ProductViewLogController extends Controller
|
||||||
$user = $request->user();
|
$user = $request->user();
|
||||||
|
|
||||||
$logs = ProductViewLog::with(['sku'])
|
$logs = ProductViewLog::with(['sku'])
|
||||||
|
->has('sku')
|
||||||
->where('user_id', $user->id)
|
->where('user_id', $user->id)
|
||||||
->whereHas('sku')
|
|
||||||
->latest('updated_at')
|
->latest('updated_at')
|
||||||
->simplePaginate(Paginator::resolvePerPage('per_page', 20, 50));
|
->simplePaginate(Paginator::resolvePerPage('per_page', 20, 50));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ Route::group([
|
||||||
Route::get('products/{product}', [ProductSkuController::class, 'show']);
|
Route::get('products/{product}', [ProductSkuController::class, 'show']);
|
||||||
|
|
||||||
Route::middleware(['auth:api'])->group(function () {
|
Route::middleware(['auth:api'])->group(function () {
|
||||||
Route::get('product-view-logs', [ProductViewLogController::class, 'index']);
|
Route::get('view-logs', [ProductViewLogController::class, 'index']);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue