The difference is the return type. find()
returns a model object, but whereId()
returns an instance of Illuminate\Database\Eloquent\Builder
.
In other words, those two statements are meaning the same thing:
$cat = Cat::find(53);
$cat = Cat::whereId(53)->first();
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community