Answer the question
In order to leave comments, you need to log in
How to bulk add Russian cities to the database using Laravel?
Tried to use this bike:
public function cities()
{
$cities=
[
'Москва',
'Санкт-Петербург'
];
foreach ($cities as $city) {
$objCity = new City;
$objCity->country_id==1;
$$objCity->name=$city;
$objCity->save();
}
}
Answer the question
In order to leave comments, you need to log in
$objCity->country_id = 1;
and
PS
when passing through the activating route methodhttps://laravel.com/docs/5.7/seeding
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question