本文整理汇总了PHP中app\User::search方法的典型用法代码示例。如果您正苦于以下问题:PHP User::search方法的具体用法?PHP User::search怎么用?PHP User::search使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\User
的用法示例。
在下文中一共展示了User::search方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index(Request $request)
{
$request->get('password');
$users = User::search($request->get('search'))->orderBy('id', 'DESC')->paginate(3);
$users->setPath('users');
return view('users.index', compact('users'));
}
示例2: search
public function search(Request $request)
{
$query = $request->get('query');
$products = Product::search($query)->get();
$users = User::search($query)->get();
return view('backend.search', compact('products', 'users'));
}
示例3: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index(Request $request)
{
if ($request->has('q')) {
$q = $request->input('q');
return view('backend.users.inde')->withUsers(User::search($q)->paginate(5));
}
return view('backend.users.inde')->withUsers(User::paginate(5));
}
示例4: store
/**
* Store a newly created resource in storage.
*
* @param Request $request
* @return Response
*/
public function store(Request $request)
{
$index = $this->algolia->initIndex('users');
// $results = $index->search($request->get('query'))['hits'];
$results = User::search($request->get('query'));
// dd($results);
return view('search.results', compact('results'));
}
示例5: users
public function users()
{
$query = session('query');
if (!User::typeExists()) {
User::addAllToIndex();
}
$users = User::search($query);
return view('search', compact('users'));
}
示例6: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{
$request->flash();
$users = User::search($request);
// $roles = Role::where('id', '>', 2)->first();
// if(!empty($roles)){
// $users = $roles->users()->get();
// }
$roles = Role::orderBy('name')->lists('name', 'id');
return view('store_user.index', compact('users', 'roles'));
}
示例7: searchUsersURL
/**
* Search users by url
*
* @param $keyword
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function searchUsersURL($keyword)
{
$users = User::search($keyword);
return view('manage.user.index', compact('users', 'keyword'));
}
示例8: search
/**
* Display a searched listing of users.
*
* @param App\Modules\Users\Http\Requests\SearchRequest $request
* @return Response
*/
public function search(SearchRequest $request)
{
$query = $request->input('query');
$users = User::search($query)->get();
return view('users::search', compact('users'));
}
示例9: search
public function search(Request $request)
{
$users = User::search($request['query'])->get();
$type = 'search';
return view('admin.user.index', compact('users', 'type'));
}
示例10: fastSearch
public function fastSearch(Request $request)
{
$this->validate($request, ['query' => 'required|min:3', 'section' => 'required|in:users,products']);
if ($request->input('section') == 'users') {
$query = User::search($request->input('query'), null, true);
$query->leftJoin('profits', 'users.id', '=', 'profits.user_id');
$query = $query->select(DB::raw("IF(profits.created_at>'" . Carbon::now()->subWeek() . "','yes','no') AS test,IFNULL(`profits`.`type`,0) AS type,(SELECT relevance)*(case when type=1 AND (SELECT test)='yes' then '" . Config::get('addonProfit.attributes')[1]['values'][1]['weight'] . "' when type=2 AND (SELECT test)='yes' then '" . Config::get('addonProfit.attributes')[1]['values'][2]['weight'] . "' when type=3 AND (SELECT test)='yes' then '" . Config::get('addonProfit.attributes')[1]['values'][3]['weight'] . "' else 1 end) AS total_relevance"))->addSelect('users.*')->groupBy('users.id')->orderBy('total_relevance', 'DESC');
$results = $query->get();
} elseif ($request->input('section') == 'products') {
$query = Product::search($request->input('query'), null, true);
$results = $query->groupBy('products.id')->get();
}
$return = view('search.partials.fastResult', compact('results'))->with(['section' => $request->input('section')])->render();
return ['hasCallback' => 1, 'callback' => 'search_fast', 'hasMsg' => 0, 'msg' => '', 'msgType' => '', 'returns' => $return];
}
示例11: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$users = User::search(Request::all())->paginate(50);
return view('user.index')->with(compact('users'));
}
示例12: index
public function index(Request $request)
{
$users = User::search($request->name)->orderBy('id', 'DESC')->paginate(5);
return view('admin.users.users')->with('users', $users);
}
示例13: filterUsers
public function filterUsers(Request $request)
{
if ($request->ajax()) {
return User::search($request->input('param'), null, true)->get();
}
}
示例14: searchUsers
/**
* Display a searched user list by given keywords
*
* @param $keywords
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function searchUsers($keywords)
{
$manage = true;
$users = User::search($keywords);
$title = count($users) ? $keywords . "的相关用户" : "无相关用户";
return view('manage.users', compact('title', 'manage', 'users'));
}