lukeraymonddowning / poser

Create class based model factories in Laravel applications in seconds.
MIT License
277 stars 10 forks source link

Generator doesn't take into account custom namespaces for factory #87

Open hailwood opened 4 years ago

hailwood commented 4 years ago

My models are in app\Models so the namespace is \App\Models

In the config file I have "models_namespace" => "App\\Models\\",

And I am generating the factories using make:poser -f so it knows the right namespace.

However the generated factories end up assuming the namespace is just \App e.g.

<?php

/** @var \Illuminate\Database\Eloquent\Factory $factory */

use App\Company;
use Faker\Generator as Faker;

$factory->define(Company::class, function (Faker $faker) {
    return [
        //
    ];
});
lukeraymonddowning commented 4 years ago

Hi @hailwood

I'll take a look into this. Thanks for the bug report! You're a 🌟