From 975c6d8b64bce929937d2eb3bf49660a729d09ab Mon Sep 17 00:00:00 2001 From: Roy Bongers Date: Fri, 23 Apr 2021 10:51:35 +0200 Subject: [PATCH] Allow loading legacy database factories --- src/Module.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Module.php b/src/Module.php index 77a5cc9..f914fe1 100644 --- a/src/Module.php +++ b/src/Module.php @@ -229,8 +229,12 @@ private function registerMiddleware(): void */ private function registerFactories(): void { - // Unfortunately Laravel 8 no longer supports loading factories like this - // because they want you to use ModelFactories. + if ( + method_exists($this, 'loadFactoriesFrom') && + file_exists($this->getModulePath().'/Database/Factories') + ) { + $this->loadFactoriesFrom($this->getModulePath().'/Database/Factories'); + } } private function registerRoutes(): void