laravel factory get foreign key

Solutions on MaxInterview for laravel factory get foreign key by the best coders in the world

showing results for - "laravel factory get foreign key"
Giada
25 Jul 2018
1'region_id' => Region::pluck('id')->random()
2 ######### OR #########
3$regions = Region::pluck('id');
4'region_id' => $this->faker->randomElement($regions);