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? (31 h 16 min)

You also get:

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

Already a member? Login here

Comments & Discussion

AG
Alex Gower ✓ Link copied!

Cool I didn't know about:

User::where{ColumnTitle}($value)->first();
GA
Ghiath Al-Khatib ✓ Link copied!

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?
		
		
		
PK
Povilas Korop ✓ Link copied!

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.

KV
Kailash Vele ✓ Link copied!

Did where day finds the day in the current month?

PK
Povilas Korop ✓ Link copied!

No, in any month.