Skip to content

Commit

Permalink
create model instance to avoid multiple instances of model
Browse files Browse the repository at this point in the history
  • Loading branch information
alexkb committed Jan 6, 2020
1 parent 8158354 commit 69542b9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Illuminate/Validation/Concerns/ValidatesAttributes.php
Expand Up @@ -819,8 +819,9 @@ public function parseTable($table)
[$connection, $table] = Str::contains($table, '.') ? explode('.', $table, 2) : [null, $table];

if (Str::contains($table, '\\') && class_exists($table) && is_a($table, Model::class, true)) {
$connection = $connection ?? (new $table)->getConnectionName();
$table = (new $table)->getTable();
$model = new $table;
$table = $model->getTable();
$connection = $connection ?? $model->getConnectionName();
}

return [$connection, $table];
Expand Down

0 comments on commit 69542b9

Please sign in to comment.