lucidarch / laravel

[DEPRECATED] See https://github.com/lucidarch/lucid

Home Page:https://lucidarch.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problem when trying to use Factories

samirgit opened this issue · comments

commented

i couldn't load database factories located in [ src/Services/{serviceName}/Database/factories ],

the Illuminate\Database\Eloquent\Factory class has a static constructor, i tried to change the factory paths by placing the below inside my ServiceProvider::register() function

$faker =  new Faker;
$this->app->singleton(Factory::class, function () use ($faker) {
      return Factory::construct($faker, realpath(__DIR__.'/../Database/factories'));
});

now the factories are available but for some reason faker stopped working properly, giving Unknown formatter "xx" errors

What's the folder structure like for the database factories in your service ?

commented

So i have an API service,

Structure for the factories: src/Services/Api/Database/factories/[All files here]

I assume that your custom factories under that directory are recognised by the service (reached and being read i.e. if you dd('something') inside that file it will die and dump it), the formatter issue is considered as a Faker issue in that case. See fzaninotto/Faker#344 and fzaninotto/Faker#441

Can you confirm?

@samirgit any updates on your issue?

commented

@Mulkave last comment Dec 2015, rebooting project in sep 15, gonna start fresh

joined Speed@BDD, i have seen you listed as a mentor, still there?