From 5b326cc8fef0742da7ec7d9927cfd0f52b3e642c Mon Sep 17 00:00:00 2001 From: Joe <104938042+lrljoe@users.noreply.github.com> Date: Sun, 8 Sep 2024 22:57:47 +0100 Subject: [PATCH] Fixes for ButtonGroupColumn, ImageColumn, LinkColumn - to not default 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 --- src/Views/Columns/ButtonGroupColumn.php | 4 +++- src/Views/Columns/ImageColumn.php | 4 +++- src/Views/Columns/LinkColumn.php | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Views/Columns/ButtonGroupColumn.php b/src/Views/Columns/ButtonGroupColumn.php index 8e1264d93..973e9b977 100644 --- a/src/Views/Columns/ButtonGroupColumn.php +++ b/src/Views/Columns/ButtonGroupColumn.php @@ -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 diff --git a/src/Views/Columns/ImageColumn.php b/src/Views/Columns/ImageColumn.php index f5d857324..a8bed5cc3 100644 --- a/src/Views/Columns/ImageColumn.php +++ b/src/Views/Columns/ImageColumn.php @@ -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 diff --git a/src/Views/Columns/LinkColumn.php b/src/Views/Columns/LinkColumn.php index 3302a1719..0edbc6436 100644 --- a/src/Views/Columns/LinkColumn.php +++ b/src/Views/Columns/LinkColumn.php @@ -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