-
Notifications
You must be signed in to change notification settings - Fork 11k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[6.x] FindBy added #30442
[6.x] FindBy added #30442
Conversation
Noe that |
Fixed |
Collections have a method named |
return; | ||
} | ||
|
||
if (count($args) == 2) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think, you should change ==
to ===
and same with line 371
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can be changed, but I don't think it matters in this case
If this is merged it would be nice to have have it like the dynamic wheres. Example: User::findByName('Joe'); |
Since you've added |
I'm guessing you're gonna have to write some tests if this is were to be merged. |
I think you can just use |
Sometimes the
find()
function it's not enough, for example, we don't have the id, but have the email of the user to find, it's can be easily usefindBy('email', '=', 'taylor@laravel.com')
orfindBy('email', 'like', '%@laravel.com%')
, this can be done withwhere('email', '=', 'taylor@laravel.com')->first()
, but, like thefind()
function, using that function will be to more productivity and will be more easily to find one user with some characteristic.