Skip to content

Commit

Permalink
Fix aggregate column snake case (#1777)
Browse files Browse the repository at this point in the history
* Add SnakeCaseToLabel

---------

Co-authored-by: lrljoe <[email protected]>
  • Loading branch information
lrljoe and lrljoe authored Jul 16, 2024
1 parent 980b361 commit 7a8ada6
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Rappasoft\LaravelLivewireTables\Views\Traits\Configuration;

use Illuminate\Database\Eloquent\{Builder, Model};
use Illuminate\Support\Str;
use Rappasoft\LaravelLivewireTables\Views\Column;

trait AggregateColumnConfiguration
Expand Down Expand Up @@ -40,10 +41,10 @@ public function setDefaultLabel(): void
{
$this->label(function ($row, Column $column) {
if ($this->hasForeignColumn()) {
return $row->{$this->getDataSource().'_'.$this->getAggregateMethod().'_'.$this->getForeignColumn()};
return $row->{Str::snake($this->getDataSource()).'_'.$this->getAggregateMethod().'_'.$this->getForeignColumn()};
}

return $row->{$this->getDataSource().'_'.$this->getAggregateMethod()};
return $row->{Str::snake($this->getDataSource()).'_'.$this->getAggregateMethod()};
});

}
Expand Down

0 comments on commit 7a8ada6

Please sign in to comment.