Skip to content

Commit

Permalink
v3 - Column - Allow Enum in ReturnType for Column getContent/renderCo…
Browse files Browse the repository at this point in the history
…ntent (#1436)

* Fix Enum Column Return TypeHints
  • Loading branch information
lrljoe authored Oct 23, 2023
1 parent c972b20 commit b4c07dc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

All notable changes to `laravel-livewire-tables` will be documented in this file

## UNRELEASED
- Fix Return Type hinting for Column Rendering to allow Enum columns

## [3.0.0-beta.4] - 2023-10-17
- Introduction of Loading Placeholder
- Docs livewire namespace fix [Here](https://github.com/rappasoft/laravel-livewire-tables/pull/1420)
Expand Down
4 changes: 2 additions & 2 deletions src/Views/Traits/Helpers/ColumnHelpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public function getColumnSelectName(): ?string
}

// TODO: Test
public function renderContents(Model $row): null|string|HtmlString|DataTableConfigurationException|\Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View
public function renderContents(Model $row): null|string|\BackedEnum|HtmlString|DataTableConfigurationException|\Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View
{
if ($this->shouldCollapseOnMobile() && $this->shouldCollapseOnTablet()) {
throw new DataTableConfigurationException('You should only specify a columns should collapse on mobile OR tablet, not both.');
Expand All @@ -103,7 +103,7 @@ public function renderContents(Model $row): null|string|HtmlString|DataTableConf
}

// TODO: Test
public function getContents(Model $row): null|string|HtmlString|DataTableConfigurationException|\Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View
public function getContents(Model $row): null|string|\BackedEnum|HtmlString|DataTableConfigurationException|\Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View
{
if ($this->isLabel()) {
$value = call_user_func($this->getLabelCallback(), $row, $this);
Expand Down

0 comments on commit b4c07dc

Please sign in to comment.