Skip to main content

whereDate() and other whereX Methods

Premium
3:17

The Full Lesson is Only for Premium Members

Want to access all of our courses? (36 h 00 min)

You also get:

61 courses
Premium tutorials
Access to repositories
Private Discord
Get Premium for $129/year or $29/month

Already a member? Login here

Alex Gower avatar

Cool I didn't know about:

User::where{ColumnTitle}($value)->first();
👍 6
Ghiath Al-Khatib avatar

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?
		
		
		
Povilas Korop avatar

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.

Kailash Vele avatar

Did where day finds the day in the current month?

Povilas Korop avatar

No, in any month.