pagina"> How to implement the most efficient database search method in Laravel's Inertia/Vue-PHP Chinese Network Q&A
How to implement the most efficient database search method in Laravel's Inertia/Vue
P粉458725040
P粉458725040 2023-08-15 18:05:26
0
1
432

I want to search the customer list and change the component as is.

I am currently searching for a specific customer using this link /customer/$searchColumn/$searchTerm?page=4

This is what my controller returns

return Inertia::render('Dashboard', [ 'customers' => Customer::whereLike("nr", (string)$request)->paginate(10), ]);

Renders a paginated table of all found items.

Vue is currently very simple:

 

On the front end, I render a table using:

 
v-for="customer in $page.props.customers.data"

I want a search box at the top of the table that reloads the results as I type.

I don't know where to start.

P粉458725040
P粉458725040

reply all (1)
P粉903969231

For this case, you can use regular ajax/fetch requests to complete.

Inertia still utilizes laravel for routing, so it's impossible to complete this kind of form request without some kind of request or redirect.

Even the creator ofinertia.jssupports usingxhr/fetch requests with inertia.

    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!