mardi 1 août 2017

Laravel Eloquent Query Builder Performance issue

I creating a wrapper function for Laravel Query Builder for creating dynamic query and not repeating same things. My function is given below

Class Crud{
  public function get($tbl,$field,$where){
     $query = Capsule::table($tbl);
     if($where != null)  $query = $query->where($where);
     $query = $query->select($field);
     return $query;
  }
}

Function call

$crud = new Crud();
$field = ['a','b','c'];
$where = ['x' => 1];
$query = $crud->get('tbl',$field,$where);

Question:

Is this query slow down performence?

Why I see log like this?

Select * from tbl
Select * from tbl where (x = ?)
Select a,b,c from tbl where (x = ?)



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2w12svi
via IFTTT

Aucun commentaire:

Enregistrer un commentaire