1
votes

working with laravel 7 and using php artisan db:seed command to table seed. then in terminal displayed database seed succesfully message. but not data table filled with data. how could I fix this problem? my existing database seedr.php file is

<?php

use Illuminate\Database\Seeder;

class DatabaseSeeder extends Seeder
{
    /**
     * Seed the application's database.
     *
     * @return void
     */
    public function run()
    {
        // $this->call(UsersTableSeeder::class);
    }
}


1
You should call your seeders classes in run function in DatabaseSeeder - Mustafa Hamdi
Or call it in terminal with this command "php artisan db:seed --class=UsersTableSeeder". Don't forgot to change UsersTableSeeder with your class - Mustafa Hamdi
@MustafaHamdi may I need this type of class for other tables? - sign458
Make a seeder class foreach table and call all of them in run function in DatabaseSeeder - Mustafa Hamdi

1 Answers

2
votes

If you have multiple seeder class then use an array

 $this->call([
        CompaniesTableSeeder::class,
        DepartmentsTableSeeder::class
 ]);