create(); foreach (Customer::all() as $customer) { $s = State::inRandomOrder()->first(); $c = $s->cities()->inRandomOrder()->first(); $customer->addresses()->create([ 'state_id' => $s->id, 'city_id' => $c->id, 'zip' => rand(12345, 54321), 'lat' => $c->lat, 'lng' => $c->lng, 'address' =>$faker->address, ]); } } }