Support the ongoing development of Laravel.io →
posted 9 years ago
Eloquent
Last updated 2 years ago.
0

You need to add ->get(), ->first(), etc. at the end.

Last updated 2 years ago.
0

raimckenzie said:

You need to add ->get(), ->first(), etc. at the end.

my question is "Eloquent Model Class has not where method. but execute correctly without error. HOW?"

Last updated 2 years ago.
0

When you call the where method on an Eloquent/Model instance the Model class delegates it to the underlying \Illuminate\Database\Eloquent\Builder instance ( Please see the __callStatic and __call methods inside Model class ). The where method inside the \Illuminate\Database\Eloquent\Builder class is merely a wrapper ( see the implementation of the where method ) that actually further delegates the call to the actual where method which is defined inside the Illuminate\Database\Query\Builder class.

Last updated 2 years ago.
0

usm4n said:

When you call the where method on an Eloquent/Model instance the Model class delegates it to the underlying \Illuminate\Database\Eloquent\Builder instance ( Please see the __callStatic and __call methods inside Model class ). The where method inside the \Illuminate\Database\Eloquent\Builder class is merely a wrapper ( see the implementation of the where method ) that actually further delegates the call to the actual where method which is defined inside the Illuminate\Database\Query\Builder class.

thank you so much!

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

dbwhddn10 dbwhddn10 Joined 25 Aug 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.