From b8cbc7da0544b3afc8cf9cde8bf83cb0736507de Mon Sep 17 00:00:00 2001 From: nguyenanhung Date: Sun, 13 Aug 2023 01:18:25 +0700 Subject: [PATCH] Optimize with mbstring --- src/Environment.php | 4 ++-- src/Model/Helper.php | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Environment.php b/src/Environment.php index 6e7799e..6a8f9a1 100644 --- a/src/Environment.php +++ b/src/Environment.php @@ -19,8 +19,8 @@ interface Environment { public const PROJECT_NAME = 'My Database Packages by HungNG'; - public const VERSION = '3.1.3'; - public const LAST_MODIFIED = '2023-02-17'; + public const VERSION = '3.1.4'; + public const LAST_MODIFIED = '2023-08-13'; public const AUTHOR_NAME = 'Hung Nguyen'; public const AUTHOR_EMAIL = 'dev@nguyenanhung.com'; public const AUTHOR_URL = 'https://nguyenanhung.com'; diff --git a/src/Model/Helper.php b/src/Model/Helper.php index 0342eb1..e7dcc4a 100644 --- a/src/Model/Helper.php +++ b/src/Model/Helper.php @@ -92,9 +92,9 @@ public function prepareOffset(int $page = 1, int $size = 10): int public function prepareOptionFormat($options = array()): ?string { if (isset($options['format']) && is_string($options['format'])) { - $format = strtolower($options['format']); + $format = mb_strtolower($options['format']); } elseif (is_string($options)) { - $format = strtolower($options); + $format = mb_strtolower($options); } else { $format = null; } @@ -212,7 +212,7 @@ public function prepareQueryStatementOptions(Builder $builder, $options = null): } // Sắp xếp dữ liệu đổ ra ngẫu nhiên nếu như Option Order By ghi nhận giá trị random - if (isset($options['orderBy']) && is_string($options['orderBy']) && strtolower($options['orderBy']) === 'random') { + if (isset($options['orderBy']) && is_string($options['orderBy']) && mb_strtolower($options['orderBy']) === 'random') { $builder->inRandomOrder(); } @@ -753,7 +753,7 @@ public function bindOrderBy(Builder $db, $orderByField, string $defaultField = ' foreach ($orderByField as $field) { $db->orderBy($table . '.' . $field['field_name'], $field['order_value']); } - } elseif (strtolower($defaultField) === 'random') { + } elseif (mb_strtolower($defaultField) === 'random') { $db->inRandomOrder(); } else { $db->orderByDesc($table . '.' . $defaultField); @@ -794,7 +794,7 @@ public function bindOrderByNoDefault(Builder $db, $orderByField, $table = null): * @param \Illuminate\Database\Query\Builder $db * @param string $field * @param mixed $table - * + *w * @return \Illuminate\Database\Query\Builder * @author : 713uk13m * @copyright: 713uk13m