mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -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();
|
||||
$city = CityModel::query()->where('location_cities.id', $adv->city)->first();
|
||||
|
||||
$adv->setAttribute('country_name', $country->name);
|
||||
$adv->setAttribute('city_name', $city->name);
|
||||
|
||||
if($country != null) {
|
||||
$adv->setAttribute('country_name', $country->name);
|
||||
}
|
||||
if($city != null) {
|
||||
$adv->setAttribute('city_name', $city->name);
|
||||
}
|
||||
return $adv;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user