mirror of
https://github.com/openclassify/openclassify.git
synced 2026-02-09 14:56:13 -06:00
If city or country can't find it was giving error
This commit is contained in:
parent
bece1c7a24
commit
22844efd87
@ -238,10 +238,12 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
|
|||||||
{
|
{
|
||||||
$country = CountryModel::query()->where('location_countries.id', $adv->country_id)->first();
|
$country = CountryModel::query()->where('location_countries.id', $adv->country_id)->first();
|
||||||
$city = CityModel::query()->where('location_cities.id', $adv->city)->first();
|
$city = CityModel::query()->where('location_cities.id', $adv->city)->first();
|
||||||
|
if($country != null) {
|
||||||
$adv->setAttribute('country_name', $country->name);
|
$adv->setAttribute('country_name', $country->name);
|
||||||
$adv->setAttribute('city_name', $city->name);
|
}
|
||||||
|
if($city != null) {
|
||||||
|
$adv->setAttribute('city_name', $city->name);
|
||||||
|
}
|
||||||
return $adv;
|
return $adv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user