mercredi 10 juin 2020

Laravel 5: Grabbing a single record from a query using `take`

Right now, I am using Eloquent like this: MobileAppUsers::where('store', '=', 'store_name')->first(); It turns out I don't need to check the store_name because the entire table is within that store's database, so I just want the single record that will be there (there will only be 1).

Without changing any other logic, would the equivalent of MobileAppUsers::where('store', '=', 'store_name')->first(); (ignoring the store_name) be : MobileAppUsers::take(1)->get(); ?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3cRHQdg
via IFTTT

Aucun commentaire:

Enregistrer un commentaire