raviawasti
2 months ago

how to get the all city data via json_decode in laravel

Posted 2 months ago by raviawasti

how to get the all city data via json_decode in larvelCity table where are id and city name 2=Newyork 4=New Delhi 5=Tokyo

foreach (json_decode($cities) as $city) {
                  $cities = App\City::where('id', $city)->first()->slug;
                  }

Print_r($cities);
exit();  ```

i want to get all the data of city via json_decode but when i follow above code i am getting the last city name only( New delhi)
want to get like this New-York-New-Delhi-Tokyo

Please sign in or create an account to participate in this conversation.