vendredi 20 septembre 2019

How do I add multiple where conditions in query dynamically using query builder

I have array of parameters and they are coming dynamically I want to make query based on parameters.

For Example

   $arr Array of parameters
(
  [shareName] => First Item
  [sharePrice] => 100
)

The Query have to add where clause dynamically

       foreach($arr as $k => $v)
    {
        $data = DB::table('itemstable')->where($k, $arr[$k])->where($k, $arr[$k])->get();      
    }

how do I know and add two where conditions ?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire