【发布时间】:2021-12-15 12:17:47
【问题描述】:
我需要在预约表中搜索代码或作为预约关系的患者姓名。这是我到目前为止达到的代码,但它不起作用:
$lab = Lab::with(['patient' => function ($q) use ($search_query) {
$q->select('id', 'avatar', DB::raw('CONCAT(first_Name, " ", second_Name) AS name')
->where('name', 'like', "%{$search_query}%")
->orWhereRaw("concat(first_name, ' ', second_name) like '%$search_query%' ")
);
}])
->select('id', 'code')
->Where('code', 'like', "%{$search_query}%")
->limit(5)
->get();
【问题讨论】:
-
约会表中没有选择
标签: php mysql sql laravel eloquent