We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 04e60d7 commit 734a450Copy full SHA for 734a450
src/Illuminate/Database/Eloquent/Model.php
@@ -737,11 +737,7 @@ public static function on($connection = null)
737
// First we will just create a fresh instance of this model, and then we can set the
738
// connection on the model so that it is used for the queries we execute, as well
739
// as being set on every relation we retrieve without a custom connection name.
740
- $instance = new static;
741
-
742
- $instance->setConnection($connection);
743
744
- return $instance->newQuery();
+ return (new static)->setConnection($connection)->newQuery();
745
}
746
747
/**
0 commit comments