Skip to content

Commit 975c6d8

Browse files
committed
Allow loading legacy database factories
1 parent 6cb5df7 commit 975c6d8

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Module.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,12 @@ private function registerMiddleware(): void
229229
*/
230230
private function registerFactories(): void
231231
{
232-
// Unfortunately Laravel 8 no longer supports loading factories like this
233-
// because they want you to use ModelFactories.
232+
if (
233+
method_exists($this, 'loadFactoriesFrom') &&
234+
file_exists($this->getModulePath().'/Database/Factories')
235+
) {
236+
$this->loadFactoriesFrom($this->getModulePath().'/Database/Factories');
237+
}
234238
}
235239

236240
private function registerRoutes(): void

0 commit comments

Comments
 (0)