Laravel, Call to undefined function Database\Seeders\factory()

后端 未结 5 1524
说谎
说谎 2021-01-05 07:46

I get the title error when I run command:

php artisan db:seed

My screenshot:

I have no idea where this problem comes from. I was sear

5条回答
  •  日久生厌
    2021-01-05 08:17

    If you are using version 8 of laravel, look at the upgrade guide. "Laravel's model factories feature has been totally rewritten to support classes and is not compatible with Laravel 7.x style factories. However, to ease the upgrade process, a new laravel/legacy-factories package has been created to continue using your existing factories with Laravel 8.x. You may install this package via Composer:

    composer require laravel/legacy-factories"

    https://laravel.com/docs/8.x/upgrade#seeder-factory-namespaces

提交回复
热议问题