File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
laravel/database/eloquent Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -230,11 +230,9 @@ public static function update($id, $attributes)
230
230
* @param array $columns
231
231
* @return Model
232
232
*/
233
- public static function find ($ id , $ columns = array ('* ' ))
233
+ public function _find ($ id , $ columns = array ('* ' ))
234
234
{
235
- $ model = new static ;
236
-
237
- return $ model ->query ()->where (static ::$ key , '= ' , $ id )->first ($ columns );
235
+ return $ this ->query ()->where (static ::$ key , '= ' , $ id )->first ($ columns );
238
236
}
239
237
240
238
/**
@@ -746,10 +744,12 @@ public function __call($method, $parameters)
746
744
return static ::$ $ method ;
747
745
}
748
746
747
+ $ underscored = array ('with ' , 'find ' );
748
+
749
749
// Some methods need to be accessed both staticly and non-staticly so we'll
750
750
// keep underscored methods of those methods and intercept calls to them
751
751
// here so they can be called either way on the model instance.
752
- if (in_array ($ method , array ( ' with ' ) ))
752
+ if (in_array ($ method , $ underscored ))
753
753
{
754
754
return call_user_func_array (array ($ this , '_ ' .$ method ), $ parameters );
755
755
}
You can’t perform that action at this time.
0 commit comments