Skip to content

Commit

Permalink
Fixes for ButtonGroupColumn, ImageColumn, LinkColumn - to not default…
Browse files Browse the repository at this point in the history
… as label if has a "from" property. (#1932)

* Initial Commit - Allowing Labels with "From" to be included in queries

* Fix styling

* Fixes for ButtonGroupColumn, ImageColumn, LinkColumn - to not default as label if has a "from" property.

---------

Co-authored-by: lrljoe <[email protected]>
  • Loading branch information
lrljoe and lrljoe authored Sep 8, 2024
1 parent f1e041e commit 5b326cc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/Views/Columns/ButtonGroupColumn.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ public function __construct(string $title, ?string $from = null)
{
parent::__construct($title, $from);

$this->label(fn () => null);
if (! isset($from)) {
$this->label(fn () => null);
}
}

public function getContents(Model $row): null|string|\Illuminate\Support\HtmlString|\Rappasoft\LaravelLivewireTables\Exceptions\DataTableConfigurationException|\Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View
Expand Down
4 changes: 3 additions & 1 deletion src/Views/Columns/ImageColumn.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ class ImageColumn extends Column
public function __construct(string $title, ?string $from = null)
{
parent::__construct($title, $from);
if (! isset($from)) {
$this->label(fn () => null);
}

$this->label(fn () => null);
}

public function getContents(Model $row): null|string|\Illuminate\Support\HtmlString|DataTableConfigurationException|\Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View
Expand Down
4 changes: 3 additions & 1 deletion src/Views/Columns/LinkColumn.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ public function __construct(string $title, ?string $from = null)
{
parent::__construct($title, $from);

$this->label(fn () => null);
if (! isset($from)) {
$this->label(fn () => null);
}
}

public function getContents(Model $row): null|string|\Illuminate\Support\HtmlString|DataTableConfigurationException|\Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View
Expand Down

0 comments on commit 5b326cc

Please sign in to comment.