register_expert
这是user_fields
表image
这是 var str2="Handrail Ext";
if (fixing.toString().indexOf(str2) === -1 || fixingDig.toString().indexOf(str2) === -1) {
console.log("$FixingDig: " + fixingDig + " $Fixing: " + fixing + "InfexOf Result: " + fixing.toString().indexOf(str2) + ".");
$('.results #handrails').val(new_posts);
$('.wpcf7-form input[name=hidden-post-handrails]').val(new_posts);
} else {
console.log("$FixingDig: " + fixingDig + " $Fixing: " + fixing + "InfexOf Result: " + fixing.toString().indexOf(str2) + ".");
$('.results #handrails').val(0);
$('.wpcf7-form input[name=hidden-post-handrails]').val("0");
}
表mage
答案 0 :(得分:0)
令人信服,
userFields
是您的模型。
userFields::selectRaw("user_fields.ID_USER_FIELD")
->join('register_expert', function($join) use ($city_save){
$join->on('register_expert.id', 'user_fields.ID_USER_FIELD')
->where('PERMISSION', '1')
->where('city', $city_save)
})->where('TITLE_USER_FIELD', $text_search_service);
尝试此代码。
答案 1 :(得分:0)
我认为Eloquent查询应该看起来像这样,但是正如我在评论中所说,数据库和查询的设计不是很好,所以我认为它不会起作用,只是您对如何使其更复杂有了一个想法雄辩的查询。
$registerExperts = RegisterExperts::whereColumn('ID_USER_FIELD', 'user_fields.ID')
->Andwhere('PERMISSION', '=', 1)
->limit(1)
->select('city')
->get();
$users = User::where($registerExperts->get('city') , '=', $city_save)
->andWhere('TITLE_USER_FIELD', '=', $text_search_service)
->get();
这是一篇很好的第一篇文章,了解如何使用Eloquent ORM进行复杂的查询:Dynamic relationships in Laravel using subqueries by Jonathan Reinink