Skip to content

Commit

Permalink
Optimize with mbstring
Browse files Browse the repository at this point in the history
  • Loading branch information
hungnguyenhp committed Aug 12, 2023
1 parent 7b8442d commit b8cbc7d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/Environment.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '[email protected]';
public const AUTHOR_URL = 'https://nguyenanhung.com';
Expand Down
10 changes: 5 additions & 5 deletions src/Model/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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();
}

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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 <[email protected]>
* @copyright: 713uk13m <[email protected]>
Expand Down

0 comments on commit b8cbc7d

Please sign in to comment.