vendredi 15 juin 2018

Laravel: Query on the same table multiple times

I have a table of users

+-------+------+-----+
| User  | Sale | Sex |
+-------+------+-----+
| user1 |  120 | M   |
| user2 |   98 | M   |
| user3 |    5 | F   |
+-------+------+-----+

in laravel, we query this by the following statement:

$allMale = UserTable::where('Sex', 'M')->get();

What will happen in I try to query again on the same table

 $allFemales = UserTable::where('Sex', 'F')->get();
 $user1 = UserTable::where('User', 'user1')->get();

will it query 3 times? is it possible to query once and then Parse it multiple times?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire