diff options
author | Sam Light <samlight1994@gmail.com> | 2025-09-23 22:54:57 +0100 |
---|---|---|
committer | Sam Light <samlight1994@gmail.com> | 2025-09-23 22:54:57 +0100 |
commit | 2aca9a441ef48fb66ace8a5bfb9d8b730bc4e925 (patch) | |
tree | a3798b6aca1882347e7e55bb1db9249196e0ee73 /src/Toolbar | |
parent | 94caf14491860e35eaf07d76e1aea7ee90e1246a (diff) |
Initial pint code formatting
Diffstat (limited to 'src/Toolbar')
-rw-r--r-- | src/Toolbar/ColumnSelect.php | 2 | ||||
-rw-r--r-- | src/Toolbar/Filter.php | 15 | ||||
-rw-r--r-- | src/Toolbar/Item.php | 10 | ||||
-rw-r--r-- | src/Toolbar/PageSize.php | 2 | ||||
-rw-r--r-- | src/Toolbar/SelectFilter.php | 9 |
5 files changed, 19 insertions, 19 deletions
diff --git a/src/Toolbar/ColumnSelect.php b/src/Toolbar/ColumnSelect.php index 9380650..8e173cd 100644 --- a/src/Toolbar/ColumnSelect.php +++ b/src/Toolbar/ColumnSelect.php @@ -13,7 +13,7 @@ class ColumnSelect extends Item return view('laralight-tables::toolbar.column-select', [ 'allColumns' => $this->getTable() ->getColumns() - ->filter(fn($c) => $c->getShowInSelect()) + ->filter(fn ($c) => $c->getShowInSelect()), ]); } } diff --git a/src/Toolbar/Filter.php b/src/Toolbar/Filter.php index f6777ce..d444dcf 100644 --- a/src/Toolbar/Filter.php +++ b/src/Toolbar/Filter.php @@ -2,10 +2,9 @@ namespace Lightscale\LaralightTables\Toolbar; -use Illuminate\Database\Eloquent\Model; -use Illuminate\Database\Eloquent\Builder; - use Closure; +use Illuminate\Database\Eloquent\Builder; +use Illuminate\Database\Eloquent\Model; abstract class Filter extends Item { @@ -19,6 +18,7 @@ abstract class Filter extends Item public function label(string $v): static { $this->label = $v; + return $this; } @@ -29,23 +29,24 @@ abstract class Filter extends Item public function filter(callable $fn): static { - $this->filterCallback = Closure::fromCallable($fn);; + $this->filterCallback = Closure::fromCallable($fn); + return $this; } /** * @template TModel of Model - * @param Builder<TModel> $query + * + * @param Builder<TModel> $query */ public function applyFilter(Builder $query): void { if ($this->filterCallback !== null) { $value = $this->getTable()->filters[$this->key] ?? null; - if (!empty($value)) { + if (! empty($value)) { ($this->filterCallback)($query, $value); } } } - } diff --git a/src/Toolbar/Item.php b/src/Toolbar/Item.php index e161fb9..1b4d1fb 100644 --- a/src/Toolbar/Item.php +++ b/src/Toolbar/Item.php @@ -2,13 +2,12 @@ namespace Lightscale\LaralightTables\Toolbar; +use Illuminate\Database\Eloquent\Model; +use Illuminate\Support\HtmlString; +use Illuminate\View\View; +use Lightscale\LaralightTables\Concerns\Makable; use Lightscale\LaralightTables\TableComponent; use Lightscale\LaralightTables\Toolbar; -use Lightscale\LaralightTables\Concerns\Makable; - -use Illuminate\View\View; -use Illuminate\Support\HtmlString; -use Illuminate\Database\Eloquent\Model; abstract class Item { @@ -35,5 +34,4 @@ abstract class Item } abstract public function render(): View|HtmlString|string|null; - } diff --git a/src/Toolbar/PageSize.php b/src/Toolbar/PageSize.php index 79234a8..71049ba 100644 --- a/src/Toolbar/PageSize.php +++ b/src/Toolbar/PageSize.php @@ -7,7 +7,7 @@ use Illuminate\View\View; class PageSize extends Item { /** - * @param array<int> $pageSizes + * @param array<int> $pageSizes */ public function __construct( private array $pageSizes = [10, 25, 50], diff --git a/src/Toolbar/SelectFilter.php b/src/Toolbar/SelectFilter.php index 7adc47a..d9c6118 100644 --- a/src/Toolbar/SelectFilter.php +++ b/src/Toolbar/SelectFilter.php @@ -2,9 +2,8 @@ namespace Lightscale\LaralightTables\Toolbar; -use Lightscale\LaralightTables\Concerns\WithAttributes; - use Illuminate\View\View; +use Lightscale\LaralightTables\Concerns\WithAttributes; class SelectFilter extends Filter { @@ -14,20 +13,23 @@ class SelectFilter extends Filter * @var iterable<string, string> */ protected iterable $options; + protected ?string $placeholder = null; public function placeholder(?string $v): static { $this->placeholder = $v; + return $this; } /** - * @param iterable<string, string> $options + * @param iterable<string, string> $options */ public function options(iterable $options): static { $this->options = $options; + return $this; } @@ -42,5 +44,4 @@ class SelectFilter extends Filter 'attributes' => $this->getAttributes(), ]); } - } |