Skip to content

Allow find to be called non-statically on Eloquent models #751

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

Merged
merged 3 commits into from
Jun 3, 2012

Conversation

jasonlewis
Copy link
Contributor

Fixes issue #738.

Signed-off-by: Jason Lewis <jason.lewis1991@gmail.com>
Signed-off-by: Jason Lewis <jason.lewis1991@gmail.com>
Signed-off-by: Jason Lewis <jason.lewis1991@gmail.com>
@lucadegasperi
Copy link
Contributor

What would be a use case for this? Once you got a model instance does it make sense to perform a find on it?

@jasonlewis
Copy link
Contributor Author

We know that find returns the first record for a given ID on the model. Find, as you can see from the issue posted, is a shorthand of User::with('roles')->where_id($id)->first()

@lucadegasperi
Copy link
Contributor

Ah ok, makes sense.
+1

taylorotwell added a commit that referenced this pull request Jun 3, 2012
Allow find to be called non-statically on Eloquent models
@taylorotwell taylorotwell merged commit cfc0577 into laravel:develop Jun 3, 2012
@taylorotwell
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants