Skip to content

Instantly share code, notes, and snippets.

@demirhanali
Created August 6, 2020 13:13
Show Gist options
  • Save demirhanali/b1113a7da3c5ac9a031000807c494f16 to your computer and use it in GitHub Desktop.
Save demirhanali/b1113a7da3c5ac9a031000807c494f16 to your computer and use it in GitHub Desktop.
<?php
use Illuminate\Database\Seeder;
class WriterSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
factory(App\Writer::class, 50)
->create()
->each(function ($writer) {
$writer->books()->createMany(
factory(App\Book::class, 3)->make()->toArray()
);
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment