Skip to content

Commit ebbae33

Browse files
lrljoegithub-actions[bot]
authored andcommitted
Fix styling
1 parent cbb5085 commit ebbae33

File tree

4 files changed

+67
-67
lines changed

4 files changed

+67
-67
lines changed

src/Views/Columns/ComponentColumn.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
use Illuminate\View\ComponentAttributeBag;
88
use Rappasoft\LaravelLivewireTables\Exceptions\DataTableConfigurationException;
99
use Rappasoft\LaravelLivewireTables\Views\Column;
10+
use Rappasoft\LaravelLivewireTables\Views\Traits\Columns\{HasComponentView, HasSlot};
1011
use Rappasoft\LaravelLivewireTables\Views\Traits\Configuration\ComponentColumnConfiguration;
1112
use Rappasoft\LaravelLivewireTables\Views\Traits\Helpers\ComponentColumnHelpers;
12-
use Rappasoft\LaravelLivewireTables\Views\Traits\Columns\{HasSlot,HasComponentView};
1313

1414
class ComponentColumn extends Column
1515
{
@@ -45,7 +45,7 @@ public function getContents(Model $row): null|string|HtmlString|DataTableConfigu
4545
if ($this->hasSlotCallback()) {
4646
$slotContent = $this->getSlotContent($row, $value);
4747
}
48-
48+
4949
return view($this->getComponentView(), [
5050
'attributes' => new ComponentAttributeBag($attributes),
5151
'slot' => $slotContent,

src/Views/Columns/ViewComponentColumn.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
use Illuminate\Support\HtmlString;
77
use Rappasoft\LaravelLivewireTables\Exceptions\DataTableConfigurationException;
88
use Rappasoft\LaravelLivewireTables\Views\Column;
9+
use Rappasoft\LaravelLivewireTables\Views\Traits\Columns\HasComponentView;
910
use Rappasoft\LaravelLivewireTables\Views\Traits\Configuration\ViewComponentColumnConfiguration;
1011
use Rappasoft\LaravelLivewireTables\Views\Traits\Helpers\ViewComponentColumnHelpers;
11-
use Rappasoft\LaravelLivewireTables\Views\Traits\Columns\HasComponentView;
1212
use ReflectionClass;
1313

1414
class ViewComponentColumn extends Column
Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
<?php
2-
3-
namespace Rappasoft\LaravelLivewireTables\Views\Traits\Columns;
4-
5-
trait HasComponentView
6-
{
7-
protected string $componentView;
8-
9-
public function component(string $component): self
10-
{
11-
$this->componentView = 'components.'.$component;
12-
13-
return $this;
14-
}
15-
16-
public function getComponentView(): string
17-
{
18-
return $this->componentView;
19-
}
20-
21-
public function hasComponentView(): bool
22-
{
23-
return isset($this->componentView);
24-
}
25-
}
1+
<?php
2+
3+
namespace Rappasoft\LaravelLivewireTables\Views\Traits\Columns;
4+
5+
trait HasComponentView
6+
{
7+
protected string $componentView;
8+
9+
public function component(string $component): self
10+
{
11+
$this->componentView = 'components.'.$component;
12+
13+
return $this;
14+
}
15+
16+
public function getComponentView(): string
17+
{
18+
return $this->componentView;
19+
}
20+
21+
public function hasComponentView(): bool
22+
{
23+
return isset($this->componentView);
24+
}
25+
}
Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
1-
<?php
2-
3-
namespace Rappasoft\LaravelLivewireTables\Views\Traits\Columns;
4-
5-
use Illuminate\Database\Eloquent\Model;
6-
use Illuminate\Support\HtmlString;
7-
use Closure;
8-
9-
trait HasSlot
10-
{
11-
protected ?Closure $slotCallback = null;
12-
13-
public function getSlotContent(Model $row, mixed $value): string|HtmlString
14-
{
15-
$slotContent = call_user_func($this->getSlotCallback(), $value, $row, $this);
16-
if (is_string($slotContent)) {
17-
$slotContent = new HtmlString($slotContent);
18-
}
19-
20-
return $slotContent;
21-
}
22-
23-
public function getSlotCallback(): ?callable
24-
{
25-
return $this->slotCallback;
26-
}
27-
28-
public function hasSlotCallback(): bool
29-
{
30-
return (isset($this->slotCallback) && $this->slotCallback !== null);
31-
}
32-
33-
public function slot(callable $callback): self
34-
{
35-
$this->slotCallback = $callback;
36-
37-
return $this;
38-
}
39-
}
1+
<?php
2+
3+
namespace Rappasoft\LaravelLivewireTables\Views\Traits\Columns;
4+
5+
use Closure;
6+
use Illuminate\Database\Eloquent\Model;
7+
use Illuminate\Support\HtmlString;
8+
9+
trait HasSlot
10+
{
11+
protected ?Closure $slotCallback = null;
12+
13+
public function getSlotContent(Model $row, mixed $value): string|HtmlString
14+
{
15+
$slotContent = call_user_func($this->getSlotCallback(), $value, $row, $this);
16+
if (is_string($slotContent)) {
17+
$slotContent = new HtmlString($slotContent);
18+
}
19+
20+
return $slotContent;
21+
}
22+
23+
public function getSlotCallback(): ?callable
24+
{
25+
return $this->slotCallback;
26+
}
27+
28+
public function hasSlotCallback(): bool
29+
{
30+
return isset($this->slotCallback) && $this->slotCallback !== null;
31+
}
32+
33+
public function slot(callable $callback): self
34+
{
35+
$this->slotCallback = $callback;
36+
37+
return $this;
38+
}
39+
}

0 commit comments

Comments
 (0)