Skip to content
Advertisement

laravel seeder is giving an error and won’t seed

I’ve been trying to get my seeder to work but it keeps giving me the following error

JavaScript

My DatabaseSeeder

JavaScript

My ContactTableSeeder

JavaScript

My ContactFactory

JavaScript

My AddressFactory

JavaScript

Contact Model

JavaScript

My Address Model

JavaScript

I have tried running composer dump-auto composer update

None of those normal fixes seem to work.

I really have no idea why its failing Thanks in advance for your help

Advertisement

Answer

In Laravel8, you need to update your factory files like below or add laravel/legacy-factories package to your project. Further info: https://laravel.com/docs/8.x/upgrade#model-factories

JavaScript

In seeders use factory like that:

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement