Laravel Limit Query Pagination
$model = ProductModel::query()
->where('status', ProductModel::ACTIVE_PRODUCT_STATUS)
->where('quantity', '>=', ProductModel::MIN_QUANTITY)
->orderByDesc('created_at')->limit(50)->get();
$total_count = $model->count();
$skip = $limit * ($page - 1);
$collection = $model->skip($skip)->take($limit);
Shadow