Skip to content
Advertisement

Laravel Seeder Does Not Work

I am using Laravel 5.4.

When I first created a project, I did migration and seeding and all worked fine.

Now I deleted the database and wanted to redo migration and seeding again, migration worked, but seeder does not.

When I entered this command:

JavaScript

the result I got was:

JavaScript

No error, no result was seed. And I should have 4 tables to be seeded but none of it being seeded.

I tried

JavaScript

but not working as well.

DatabaseSeeder.php

JavaScript

ATableSeeder.php

JavaScript

Any idea why?

Advertisement

Answer

It was the ‘timezone‘ in config/app.php caused the issue. When I first migrated with the default timezone, which is ‘UTC’, everything works fine. Then I changed the timezone to ‘UTC+8’, and created_at and updated_at are working fine too. Then here comes the problem. I did migration again with the timezone ‘UTC+8’ and then stuck at the seeding part.

So now I changed the timezone to ‘Asia/Kuala_Lumpur’, everything is working perfectly fine!

Thank you guys!

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