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

maharzan's avatar

Live search filter on parent component

I was trying to do some vue/inertia/laravel project but got stuck at this. I have a search box on the topNav component and the results appear on the layout at the bottom. the filters Object for search (input value) which is coming from inertia/laravel can be accessed from the bottom layout (thats where its routed from laravel). I do not know if it can be accessed from the TopNav component since it would be a parent. If there is anyway to do this in Inertia/vue, please let me know. Should we use Pinia for this kind of thing?

Thanks all.

0 likes
3 replies
dcx's avatar

There are many ways to do this, i would recommend checking out using a Vue3 composable https://vuejs.org/guide/reusability/composables.html in that case your search will call a method on the composable and you can reuse the results (and the search) in any components you want at any level...

maharzan's avatar

Thank you for the reply. I am doing this from inertia

return Inertia::render('Database', [ 'filters' => Request::only(['search']) ]);

and grabbing the filters in the Database.vue

let props = defineProps({ filters: Object });

So not sure how we can convert that to composable.. Any idea? I want to grab the filters on to another component (parent).

maharzan's avatar

Is it that you don't sent the filter to inertia at all?

Please or to participate in this conversation.