Skip to content

Create Filters from Query Result #396

Closed Answered by rappasoft
MxFlorin asked this question in Q&A
Discussion options

You must be logged in to vote
public function filters(): array
{
    return [
        'categories' => Filter::make('Categories')
            ->select(Categories::all()->map->only('id', 'name')),
    ];
}

As long as whatever you send to select is $key => $value

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@MxFlorin
Comment options

@rappasoft
Comment options

Answer selected by MxFlorin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants