mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
fixed exception && hide filter location for backend
This commit is contained in:
parent
686941a892
commit
76caa0a233
@ -139,7 +139,7 @@ class AdvModel extends AdvsAdvsEntryModel implements AdvInterface
|
||||
$foreign_currency[$currencyIn] = $price * $rate;
|
||||
}
|
||||
}
|
||||
} catch (RequestException $e) {
|
||||
} catch (\Exception $e) {
|
||||
$this->messages->error((!is_null($e->getMessage())) ? $e->getMessage() : trans('streams::error.500.message'));
|
||||
}
|
||||
}
|
||||
|
||||
@ -75,7 +75,7 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
|
||||
|
||||
$query = $query->leftJoin('advs_advs_translations', function ($join) {
|
||||
$join->on('advs_advs.id', '=', 'advs_advs_translations.entry_id');
|
||||
$join->where('advs_advs_translations.locale', '=', Request()->session()->get('_locale',setting_value('streams::default_locale')));
|
||||
$join->where('advs_advs_translations.locale', '=', Request()->session()->get('_locale', setting_value('streams::default_locale')));
|
||||
});
|
||||
|
||||
if (!empty($param['keyword'])) {
|
||||
@ -91,15 +91,25 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
|
||||
});
|
||||
}
|
||||
}
|
||||
$country = isset($param['country']) ?
|
||||
$param['country'] : setting_value('visiosoft.module.location::default_country');
|
||||
if ($country) {
|
||||
$query = $query->where('country_id', $country);
|
||||
}
|
||||
if ($city) {
|
||||
$query = $query->where('city', $city->id);
|
||||
} elseif (isset($param['city']) and !empty($param['city']) and !empty(array_filter($param['city']))) {
|
||||
$query = $query->whereIn('city', $param['city']);
|
||||
if (!setting_value('visiosoft.module.location::hide_location_filter')) {
|
||||
$country = isset($param['country']) ? $param['country'] : setting_value('visiosoft.module.location::default_country');
|
||||
if ($country) {
|
||||
$query = $query->where('country_id', $country);
|
||||
}
|
||||
if ($city) {
|
||||
$query = $query->where('city', $city->id);
|
||||
} elseif (isset($param['city']) and !empty($param['city']) and !empty(array_filter($param['city']))) {
|
||||
$query = $query->whereIn('city', $param['city']);
|
||||
}
|
||||
if (isset($param['district']) and !empty(array_filter($param['district']))) {
|
||||
$query = $query->whereIn('district', $param['district']);
|
||||
}
|
||||
if (isset($param['neighborhood']) and !empty(array_filter($param['neighborhood']))) {
|
||||
$query = $query->whereIn('neighborhood', $param['neighborhood']);
|
||||
}
|
||||
if (isset($param['village']) and !empty(array_filter($param['village']))) {
|
||||
$query = $query->whereIn('village', $param['village']);
|
||||
}
|
||||
}
|
||||
if ($category) {
|
||||
$cat = new CategoryModel();
|
||||
@ -116,15 +126,6 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
|
||||
if (!empty($param['user'])) {
|
||||
$query = $query->where('advs_advs.created_by_id', $param['user']);
|
||||
}
|
||||
if (isset($param['district']) and !empty(array_filter($param['district']))) {
|
||||
$query = $query->whereIn('district', $param['district']);
|
||||
}
|
||||
if (isset($param['neighborhood']) and !empty(array_filter($param['neighborhood']))) {
|
||||
$query = $query->whereIn('neighborhood', $param['neighborhood']);
|
||||
}
|
||||
if (isset($param['village']) and !empty(array_filter($param['village']))) {
|
||||
$query = $query->whereIn('village', $param['village']);
|
||||
}
|
||||
if (!empty($param['min_price'])) {
|
||||
$num = $param['min_price'];
|
||||
$int = (int)$num;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user