Skip to content

Commit

Permalink
[9.x] Factory generation fixes (#41688)
Browse files Browse the repository at this point in the history
* initial pass at fix

* simplify fix
  • Loading branch information
taylorotwell authored Mar 29, 2022
1 parent f5d8e84 commit abe8e20
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,9 @@ protected function buildClass($name)

$model = class_basename($namespaceModel);

if (Str::startsWith($namespaceModel, $this->rootNamespace().'Models')) {
$namespace = Str::beforeLast('Database\\Factories\\'.Str::after($namespaceModel, $this->rootNamespace().'Models\\'), '\\');
} else {
$namespace = 'Database\\Factories';
}
$namespace = $this->getNamespace(
Str::replaceFirst($this->rootNamespace(), 'Database\\Factories\\', $this->qualifyClass($this->getNameInput()))
);

$replace = [
'{{ factoryNamespace }}' => $namespace,
Expand Down

0 comments on commit abe8e20

Please sign in to comment.