Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Ajvanho's avatar
Level 14

Frontend query string for Spatie query builder

How to make on frontend query string for Spatie query builder?

@foreach(\App\Product::get()->pluck("name") as $value => $name)

<a href="{{ route('products.index', ['filter[name]'=>$name ]) }}" >{{$name}}</a>

@endforeach

Result is this:
http://test.test/products?filter%5Bname%5D=armani

wanted :
http://test.test/products?filter[name]=armani
0 likes
4 replies
automica's avatar
automica
Best Answer
Level 54

@ivanradojevic your result is functionally the same as your 'wanted' version, but is just url encoded.

Ajvanho's avatar
Level 14

This can cause a problem how to determine the active link. Is it possible to decode somehow?

Ajvanho's avatar
Level 14

This Spatie package has so many ambiguities, that I decided to give it up.

Please or to participate in this conversation.