Answers for "how to seed table with relationship in laravel 8"

PHP
11

seed one table laravel

php artisan db:seed --class=UserSeeder
Posted by: Guest on August-24-2020
0

laravel seeder with relationship

use App\Models\User;
 
/**
 * Run the database seeders.
 *
 * @return void
 */
public function run()
{
    User::factory()
            ->count(50)
            ->hasPosts(1)
            ->create();
}
Posted by: Guest on March-16-2022

Code answers related to "how to seed table with relationship in laravel 8"

Browse Popular Code Answers by Language