谁能帮我修复此代码?
public function caritindaklanjut(Request $request){
$halaman="tindaklayanan";
$cari = '%'.$request->search.'%';
$rows=DB::table('keluhans')
->select(DB::raw('id,produk,username,masalah,status,id_departemen'))
->where('status','=','Pending')
->where(function($query) {
$query->where('produk','like',$cari)
->orWhere('username','like',$cari)
->orWhere('masalah','like',$cari);
})->orderby('id','asc')->get();
它无法将$ cari传递到$ query并出现错误...请帮助:)
最佳答案
添加use($cari)
:
->where(function($query) use($cari) {