use Illuminate\Database\Seeder;
class ClientTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
factory(App\Client::class, 10)->make()->each(function ($client) {
$address = factory(App\Address::class)->create();
$client->address()
->associate($address)
->save();
});
}
}
Last active
October 28, 2016 01:47
-
-
Save flyingluscas/e0a194be1bf668c9af515ef033e684b9 to your computer and use it in GitHub Desktop.
Laravel - Example of relationships on seeders
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment