Skip to content

Commit a9f9c58

Browse files
authored
Merge pull request #5443 from Sy-Dante/fix-grid_column_label_not_support_bool_value
fix: grid column label function not support boolean value
2 parents f4f69cb + 9ae1d19 commit a9f9c58

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Grid/Displayers/Label.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,12 @@ public function display($style = 'success')
1515

1616
return collect((array) $this->value)->map(function ($item) use ($style) {
1717
if (is_array($style)) {
18-
if (is_string($this->getColumn()->getOriginal()) || is_int($this->getColumn()->getOriginal())) {
19-
$style = Arr::get($style, $this->getColumn()->getOriginal(), 'success');
18+
$columnValue = $this->getColumn()->getOriginal();
19+
20+
if (is_string($columnValue) || is_int($columnValue) || is_bool($columnValue)) {
21+
$columnValue = is_bool($columnValue) ? (int) $columnValue : $columnValue;
22+
23+
$style = Arr::get($style, $columnValue, 'success');
2024
} else {
2125
$style = Arr::get($style, $item, 'success');
2226
}

0 commit comments

Comments
 (0)