You need to add ->get()
, ->first()
, etc. at the end.
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?"
http://laravel.com/api/master/Illuminate/Database/Eloquent/Model.html#method___callStatic You can see how it executes here — https://github.com/laravel/framework/blob/master/src/Illuminate/Database/Eloquent/Model.php#L3134 .
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.
usm4n said:
When you call the
where
method on anEloquent/Model
instance theModel
class delegates it to the underlying\Illuminate\Database\Eloquent\Builder
instance ( Please see the__callStatic
and__call
methods insideModel
class ). Thewhere
method inside the\Illuminate\Database\Eloquent\Builder
class is merely a wrapper ( see the implementation of thewhere
method ) that actually further delegates the call to the actualwhere
method which is defined inside theIlluminate\Database\Query\Builder
class.
thank you so much!
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community