Hi friends, I try to make a modular Laravel application. I use "https://github.com/bstrahija/laravel-modules-example" for beginning point of my project. Now I have a problem to call seed from install module. "Artisan::call('migrate', array('--env' => App::environment()));" works perfeclty-create all needed tables, which are placed "into app/database/migrate" folder. But when I call "Artisan::call('db:seed');" to seed database files which is placed into "app/database/seeds", that result nothing. What I do wrong?
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:
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
Yes, I have those files in seed folder and add them into DatabaseSeeder.php file, but it doesn't result anything in database...
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
)
));
The last answer from awsp worked for me! thx!
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community