Generate Factory in Laravel 5.5

11,881

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"
Share:
11,881

Related videos on Youtube

abu abu
Author by

abu abu

Updated on June 04, 2022

Comments

  • abu abu
    abu abu almost 2 years

    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 ?