From 1f2a7eb420527e38e133cbf7b3c5889e097a133b Mon Sep 17 00:00:00 2001
From: jqh <841324345@qq.com>
Date: Mon, 8 Mar 2021 23:18:07 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=A1=A8=E6=A0=BC=E8=A7=84?=
=?UTF-8?q?=E6=A0=BC=E9=80=89=E6=8B=A9=E5=99=A8=E5=AD=98=E5=9C=A8=E5=A4=9A?=
=?UTF-8?q?=E4=B8=AA0=E5=BC=80=E5=A4=B4=E9=80=89=E9=A1=B9=E6=97=B6?=
=?UTF-8?q?=E9=80=89=E4=B8=AD=E5=8A=9F=E8=83=BD=E5=BC=82=E5=B8=B8=E9=97=AE?=
=?UTF-8?q?=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
resources/views/grid/selector.blade.php | 2 +-
src/Grid/Tools/Selector.php | 8 ++++++--
src/Support/Helper.php | 5 +++--
3 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/resources/views/grid/selector.blade.php b/resources/views/grid/selector.blade.php
index d2d33fb21..bcddef79f 100644
--- a/resources/views/grid/selector.blade.php
+++ b/resources/views/grid/selector.blade.php
@@ -6,7 +6,7 @@
@foreach($selector['options'] as $value => $option)
@php
- $active = in_array($value, \Illuminate\Support\Arr::get($selected, $column, []));
+ $active = in_array((string) $value, \Illuminate\Support\Arr::get($selected, $column, []), true);
@endphp
-
selected = $selected;
@@ -182,8 +186,8 @@ public function url($column, $value = null, $add = false)
return $this->request->fullUrlWithQuery($query);
}
- if (in_array($value, $options)) {
- Helper::deleteByValue($options, $value);
+ if (in_array((string) $value, $options, true)) {
+ Helper::deleteByValue($options, (string) $value, true);
} else {
if ($add) {
$options = [];
diff --git a/src/Support/Helper.php b/src/Support/Helper.php
index 61a6ab556..27988f52c 100755
--- a/src/Support/Helper.php
+++ b/src/Support/Helper.php
@@ -417,13 +417,14 @@ public static function exportArrayPhp(array $array)
*
* @param array $array
* @param mixed $value
+ * @param bool $strict
*/
- public static function deleteByValue(&$array, $value)
+ public static function deleteByValue(&$array, $value, bool $strict = false)
{
$value = (array) $value;
foreach ($array as $index => $item) {
- if (in_array($item, $value)) {
+ if (in_array($item, $value, $strict)) {
unset($array[$index]);
}
}