summaryrefslogtreecommitdiff
path: root/src/Toolbar/SelectFilter.php
blob: 05498859afc74de6deb4bf074ea09c4469e88c95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php

namespace Lightscale\LaralightTables\Toolbar;

use Illuminate\View\View;

class SelectFilter extends Filter
{
    protected iterable $options;
    protected ?string $placeholder = null;

    public function placeholder(?string $v): static
    {
        $this->placeholder = $v;
        return $this;
    }

    public function options(iterable $options): static
    {
        $this->options = $options;
        return $this;
    }

    public function render(): View
    {
        return view('laralight-tables::toolbar.select-filter', [
            'id' => $this->makeId(),
            'key' => $this->key,
            'label' => $this->label,
            'options' => $this->options,
            'placeholder' => $this->placeholder,
        ]);
    }

}