0

I have got some problem with Seeding. I create new seed file:

php artisan make:seeder RoleUserSeeder

i run method i added:

DB::table('role_user')->insert([
    'role_id' => 1,
    'user_id' => 2,
]);

and then try: php artisan optimize Generating optimized class loader php artisan db:seed

but they do not add record in role_user table

I do not have any errors

Thanks for help

Pionas
  • 346
  • 1
  • 4
  • 15

1 Answers1

0

You have to add $this->call(RoleUserSeeder::class); in your DatabaseSeeder class (located in /database/seeds).

Koga
  • 555
  • 1
  • 5
  • 18
  • It does not work, but when i copy `DB::table('role_user')->insert([ 'role_id' => 1, 'user_id' => 2, ]);` to DatabaseSeeder it works – Pionas Dec 15 '15 at 15:56
  • 1
    Do you get an error message when you use `$this->call`? – Koga Dec 15 '15 at 16:03
  • No errors but when i added `echo "test"` before call i saw this text, after call no – Pionas Dec 15 '15 at 17:09