Skip to content

Commit

Permalink
fix #867
Browse files Browse the repository at this point in the history
  • Loading branch information
jqhph committed Dec 23, 2020
1 parent d554c3c commit d1b0028
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Admin
use HasAssets;
use HasHtml;

const VERSION = '2.0.12-beta';
const VERSION = '2.0.13-beta';

const SECTION = [
// 往 <head> 标签内输入内容
Expand Down
4 changes: 1 addition & 3 deletions src/Grid/Column.php
Original file line number Diff line number Diff line change
Expand Up @@ -545,9 +545,7 @@ public function fill($data)
$value = $this->callDisplayCallbacks($this->original);
}

if ($value !== $this->value) {
Helper::arraySet($row, $this->name, $value);
}
Helper::arraySet($row, $this->name, $value);
}

$this->value = $value ?? null;
Expand Down
8 changes: 7 additions & 1 deletion src/Support/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,13 @@ public static function arraySet(&$array, $key, $value)
if (is_array($array)) {
$array = &$array[$key];
} else {
$array[$key] = static::arraySet($array[$key], implode('.', $keys), $value);
if (is_object($array[$key])) {
$array[$key] = static::arraySet($array[$key], implode('.', $keys), $value);
} else {
$mid = $array[$key];

$array[$key] = static::arraySet($mid, implode('.', $keys), $value);
}
}
}

Expand Down
6 changes: 5 additions & 1 deletion tests/Controllers/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,16 @@ protected function grid()

$grid->model()->with(['tags', 'profile']);

$grid->number();

$grid->id('ID')->sortable();

$grid->username();
$grid->email();
$grid->mobile();
$grid->full_name();
$grid->full()->display(function () {
return $this->full_name;
});
$grid->avatar()->display(function ($avatar) {
return "<img src='{$avatar}' />";
});
Expand Down

0 comments on commit d1b0028

Please sign in to comment.