使用实时结果在laravel数据库中搜索 [英] search in laravel database with live results
问题描述
我正在使用Laravel 5.4,并且在管理面板中有一个用户列表,我想在用户列表的顶部添加搜索框以搜索他们,并且我希望结果是实时的(在输入单词结果显示时)猜测应该为此使用Ajax(不确定!)
I'm working with Laravel 5.4 and I have a list of users in admin panel I want to add search box in top of my users list to search them and I want to results be live (when typing words results shows) I guess should use Ajax for that(not sure!)
假设这是我的用户列表代码:
Let say this is my users list code:
@foreach ($users as $user)
<td>{{ $user->first_name }}</td>
<td>{{ $user->last_name }}</td>
<td>{{ $user->username }}</td>
<td>{{ $user->email }}</td>
@endforeach
如何使该搜索与之配合使用?
How can I get that search to work with it?
我应该安装任何插件还是仅使用Vue.Js或...?
Should I install any plugin or just use Vue.Js or ...?
谢谢.
推荐答案
您实际上必须为此使用ajax技术. 但只有一次..让angularJS或vue执行搜索功能.. 我实际上想在此处发布摘要,但似乎有一个错误..所以这里有一个样本你可能想看..
you actually must use ajax technology for this .. but only once .. let the angularJS or vue do the searching function .. i actually wanted to post a snippet here but there's seems to be a bug .. so here's a sample you might wanna see ..
这篇关于使用实时结果在laravel数据库中搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!