feat: 統一各模組分頁組件佈局並新增系統設定功能相關檔案
All checks were successful
ERP-Deploy-Demo / deploy-demo (push) Successful in 1m5s
All checks were successful
ERP-Deploy-Demo / deploy-demo (push) Successful in 1m5s
This commit is contained in:
@@ -40,7 +40,13 @@ class RecipeController extends Controller
|
||||
|
||||
$query->orderBy($request->input('sort_field', 'created_at'), $request->input('sort_direction', 'desc'));
|
||||
|
||||
$recipes = $query->paginate($request->input('per_page', 10))->withQueryString();
|
||||
$defaultPerPage = \App\Modules\Core\Models\SystemSetting::getVal('display.per_page', 10);
|
||||
$perPage = (int) $request->input('per_page', $defaultPerPage);
|
||||
if (!in_array($perPage, [10, 20, 50, 100])) {
|
||||
$perPage = $defaultPerPage;
|
||||
}
|
||||
|
||||
$recipes = $query->paginate($perPage)->withQueryString();
|
||||
|
||||
// Manual Hydration
|
||||
$productIds = $recipes->pluck('product_id')->unique()->filter()->toArray();
|
||||
|
||||
Reference in New Issue
Block a user