dimanche 23 septembre 2018

Laravel Query builder: Take and limit methods

I dont undertand how these methods work, I'm trying to get last records inserted in my db and for this, I need a query builder so I made y consult with something like this:

 $costo = Costo_promedio::where('producto_nombre_id',$id_prod->id)->latest()->take(1);

The thing is I'm still getting all records inserted, in these methods take or limit I send the paramether of how many i want to get, and my question is. Why does this happen??



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire