Monday, April 3, 2017

Multiple Where on Laravel not working

Can anyone help me fix this code ?

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();

It cant pass $cari into $query and getting error... Please Help :)



via Christianus Andre

Advertisement