我已尝试在搜索查询中传递不同的参数,但它无法正常显示错误的结果。我在我的数据库中拥有美国国家,所以我想搜索任何一个搜索任何先来获得美国结果然后其他国家结果。它从数据库中随机获得结果。
控制器功能代码:
@Override
protected void onNewIntent(Intent intent) {
String action = intent.getAction();
if(Intent.ACTION_SEND.equals(action)&&intent.hasExtra(Intent.EXTRA_STREAM))
{
Uri uri = (Uri) intent.getParcelableExtra(Intent.EXTRA_STREAM);
if ("text/".equals(type)) {
String shareText = intent.getDataString();
//handleSendText(intent); // Handle text being sent
} else if (type.startsWith("image/")) {
getDataFromUri(intent,activity);
}
}
下面是我用来列出所有数据的视图代码
查看代码:
$data['countries'] = Countries::orderBy('name', 'ASC')->where('id', '!=', '231')->get();
$data['categories'] = categories::get();
$query = UserProfiles::join('users', 'users_profiles.user_id', '=', 'users.id');
$query->join('countries','users_profiles.country','=','countries.id');
$query->join('states','users_profiles.state','=','states.id');
if(!empty($request->category)){
$query->where('users.member_type',$request->category);
}
if(!empty($request->country)){
$query->where('users_profiles.country', $request->country);
}
if(!empty($request->state)){
$query->where('users_profiles.state', $request->state);
}
if(!empty($request->type)){
$query->where('users_profiles.type_surrogacy', $request->type);
}
if(!empty($request->city)){
$query->where('users_profiles.city', $request->city);
}
if(!empty($request->willing_to)){
$query->where('users_profiles.willing_to_assist', $request->willing_to);
}
if(!empty($request->languages)){
$query->where('users_profiles.languages', $request->languages);
}
if(!empty($request->country)){
$query->where('users_profiles.country', $request->country);
}
if(!empty($request->education)){
$query->where('users_profiles.education', $request->education);
}
if(!empty($request->smoker)){
$query->where('users_profiles.smoker', $request->smoker);
}
if(!empty($request->hair_color)){
$query->where('users_profiles.hair_color', $request->hair_color);
}
if(!empty($request->eye_color)){
$query->where('users_profiles.eye_color', $request->eye_color);
}
if(!empty($request->marital_status)){
$query->where('users_profiles.marital_status', $request->marital_status);
}
$query->select('users.*','countries.name as country','states.name as state');
$data['search_results'] = $query->paginate(15);