Support the ongoing development of Laravel.io →
Database Eloquent
Last updated 2 years ago.
0

Seeders need to be registered by adding them to the call function of the DatabaseSeeder.php file... They won't be run automatically if you've just dropped them into the folder:

http://laravel.com/docs/migrations#database-seeding

Last updated 2 years ago.
0

Or you could use Way's package as it will create the seed file and auto insert that line (register) for you. https://packagist.org/packages/way/generators

php artisan generate:seed users
Last updated 2 years ago.
0

Yes, I have those files in seed folder and add them into DatabaseSeeder.php file, but it doesn't result anything in database...

Last updated 2 years ago.
0

May not be the answer, but try check your seeder to see if you have equal columns for every inserts. For instance,

DB::table('users')->insert(array(
    array(
       'firstname' => 'foo',
       'lastname' => 'bar',
    ),
    array(
       'firstname' => 'foo2', // lastname field is missing on 2nd array
    )
));
Last updated 2 years ago.
0

The last answer from awsp worked for me! thx!

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

mrakodol mrakodol Joined 14 Mar 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.