I ran below command

php artisan make:factory AddressFactory

I am getting below result

$factory->define(Model::class, function (Faker $faker) {

But I would like to get result like below

$factory->define(App\Address::class, function (Faker $faker) {

What should I do ?


Solution 1:

If you want the make:factory command to generate a factory class for an existing model, you need to tell it which model to use with the --model option:

php artisan make:factory AddressFactory --model="App\\Address"