Lesson 15/32 · 3:17 min
Cool I didn't know about:
User::where{ColumnTitle}($value)->first();
hello,I have a question about executing more than one query without it being affected
$users = User::query(); $users1 = $users->where('id', 1)->get(); // true $users2 = $users->where('id', 2)->get(); // empty ``` My way ```php $users = User::query(); $query = clone $users; $users1 = $users->where('id', 1)->get(); // true $users2 = $query->where('id', 2)->get(); // true ``` Is this the best way?
Interesting, I don't remember trying it in this way, cloning $users is totally fine by me. But I'm not sure I would even combine these, I would probably execute it in totally different two queries, for readability.
Did where day finds the day in the current month?
No, in any month.
Cool I didn't know about:
hello,I have a question about executing more than one query without it being affected
Interesting, I don't remember trying it in this way, cloning $users is totally fine by me. But I'm not sure I would even combine these, I would probably execute it in totally different two queries, for readability.
Did where day finds the day in the current month?
No, in any month.