Route get test22 function all_c AddrCountryConsulate all foreach all_c

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Route::get('/test22', function() {
$all_c = \AddrCountryConsulate::all();
$i = 0;
foreach ($all_c as $c) {
/*
$country = \AddrCountry::where('title_ru', $c->country)->first();
if ($country) {
$c->country_id = $country->country_id;
$c->save();
//echo ' - '.$country->country_id;
} else {
echo $c->country;
}
echo '<br/>';
if ($c->country_id != 0) {
$city = \AddrCity::where('title_ru', $c->city)->where('country_id', $c->country_id)->first();
if ($city) {
$c->city_id = $city->city_id;
$c->save();
echo $i++.'<br/>';
}
}*/
}
});