adhik13th
1 month ago

Search function get wrong value

Posted 1 month ago by adhik13th

I create a search function to search data on table , but this result on search is not like what i need . its because i cant/not know how to put i line query on where clause . this function like this

public function search(Request $request)
{
    
    $ipsrs_id = Auth::user()->roles->ipsrs_id;
    $cari = $request->cari;


    $ipsrs_aduan = Aduan::where('ipsrs_id',$ipsrs_id);// i dont know where i can put this line


    $query = Aduan::query();
   
    $columns = ['aduan', 'nama_pengadu', 'status' ];
    foreach($columns as $column){
        
        $query->orWhere($column,'like','%'.$cari.'%');
    }   
    $aduan = $query->paginate();

    return view('admin.report_sarpras',['aduan' => $aduan]);
}

this problem is i cant put this line

 $ipsrs_aduan = Aduan::where('ipsrs_id',$ipsrs_id);// i dont know where i can put this line

someone can help this ??

Please sign in or create an account to participate in this conversation.