From c19d530d266c0ef0d50eaa972a71bcb9d1156f9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Baconnier?= Date: Mon, 11 Feb 2019 22:06:47 +0100 Subject: [PATCH 1/2] Fix undefined variable factory when loading factories related to #391 --- src/Support/ServiceProvider.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Support/ServiceProvider.php b/src/Support/ServiceProvider.php index 2bac1b6f..05c43cec 100644 --- a/src/Support/ServiceProvider.php +++ b/src/Support/ServiceProvider.php @@ -5,6 +5,7 @@ use SplFileInfo; use Symfony\Component\Finder\Finder; use Illuminate\Support\ServiceProvider as IlluminateServiceProvider; +use use Illuminate\Database\Eloquent\Factory; class ServiceProvider extends IlluminateServiceProvider { @@ -65,9 +66,7 @@ protected function loadConfigsFrom($path) */ protected function loadFactoriesFrom($path) { - foreach (glob($path.'/*.php') as $file) { - require $file; - } + app(Factory::class)->load($path); } /** From 91d5590332ba23110afbd54692d0a1382f718a2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Baconnier?= Date: Mon, 11 Feb 2019 22:40:51 +0100 Subject: [PATCH 2/2] Fix copy/pasta --- src/Support/ServiceProvider.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Support/ServiceProvider.php b/src/Support/ServiceProvider.php index 05c43cec..082a89a2 100644 --- a/src/Support/ServiceProvider.php +++ b/src/Support/ServiceProvider.php @@ -5,7 +5,7 @@ use SplFileInfo; use Symfony\Component\Finder\Finder; use Illuminate\Support\ServiceProvider as IlluminateServiceProvider; -use use Illuminate\Database\Eloquent\Factory; +use Illuminate\Database\Eloquent\Factory; class ServiceProvider extends IlluminateServiceProvider {