Skip to content

Commit d609cd6

Browse files
authored
Add Value to BooleanColumn view
1 parent c15c1d1 commit d609cd6

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/Views/Columns/BooleanColumn.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public function getContents(Model $row): null|string|\Illuminate\Support\HtmlStr
4545
->withIsBootstrap($this->isBootstrap())
4646
->withSuccessValue($this->getSuccessValue())
4747
->withType($this->getType())
48+
->withValue($value)
4849
->withStatus($this->hasCallback() ? call_user_func($this->getCallback(), $value, $row) : (bool) $value === true);
4950
}
5051
}

tests/Views/Columns/BooleanColumnTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,20 @@ public function test_can_set_toggleable_with_confirm_message(): void
104104
$this->assertTrue($column->hasConfirmMessage());
105105

106106
$this->assertSame('Are you sure?', $column->getConfirmMessage());
107+
}
107108

109+
public function test_can_get_value(): void
110+
{
111+
$column = BooleanColumn::make('Name')->getContents(Pet::find(1));
112+
$this->assertSame($column['value'], 'Cartman');
108113
}
114+
115+
public function test_can_get_is_tailwind(): void
116+
{
117+
$column = BooleanColumn::make('Name')->getContents(Pet::find(1));
118+
$this->assertSame($column['isTailwind'], true);
119+
$this->assertSame($column['isBootstrap'], false);
120+
121+
}
122+
109123
}

0 commit comments

Comments
 (0)