From 55deb654b66d608063d18068930281c2d674b84c Mon Sep 17 00:00:00 2001 From: Braden Keith Date: Mon, 10 Jun 2019 18:34:06 -0400 Subject: [PATCH] Fix reliance on faker --- src/MultitenancyServiceProvider.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/MultitenancyServiceProvider.php b/src/MultitenancyServiceProvider.php index 1c46119..b39d186 100644 --- a/src/MultitenancyServiceProvider.php +++ b/src/MultitenancyServiceProvider.php @@ -2,6 +2,8 @@ namespace RomegaDigital\Multitenancy; +use Illuminate\Database\Eloquent\Factory as EloquentFactory; +use Faker\Generator as FakerGenerator; use Illuminate\Filesystem\Filesystem; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Gate; @@ -27,8 +29,12 @@ public function boot(Filesystem $filesystem) if ($this->app->runningInConsole()) { $this->registerPublishing($filesystem); } - - $this->app->make('Illuminate\Database\Eloquent\Factory')->load(__DIR__.'/Factories'); + + $this->app->singleton(EloquentFactory::class, function ($app) { + return EloquentFactory::construct( + $app->make(FakerGenerator::class), __DIR__.'/Factories' + ); + }); $this->registerCommands(); $this->registerModelBindings();