mirror of
https://github.com/openclassify/openclassify.git
synced 2026-02-10 23:36:08 -06:00
Merge pull request #651 from openclassify/vedatakd
fixed exception && hide filter location for backend
This commit is contained in:
commit
865cd9a273
@ -8,6 +8,7 @@ return [
|
|||||||
'title' => 'visiosoft.module.advs::section.general',
|
'title' => 'visiosoft.module.advs::section.general',
|
||||||
'fields' => [
|
'fields' => [
|
||||||
'market_place',
|
'market_place',
|
||||||
|
'show_lang_url',
|
||||||
'iban_numbers',
|
'iban_numbers',
|
||||||
'google_statistic_code',
|
'google_statistic_code',
|
||||||
'ogImage',
|
'ogImage',
|
||||||
|
|||||||
@ -228,4 +228,11 @@ return [
|
|||||||
'default_value' => false,
|
'default_value' => false,
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
|
||||||
|
'show_lang_url' => [
|
||||||
|
'type' => 'anomaly.field_type.boolean',
|
||||||
|
'config' => [
|
||||||
|
'default_value' => false,
|
||||||
|
]
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
@ -146,4 +146,7 @@ return [
|
|||||||
'hide_map_filter' => [
|
'hide_map_filter' => [
|
||||||
'name' => 'Hide Map Filter',
|
'name' => 'Hide Map Filter',
|
||||||
],
|
],
|
||||||
|
'show_lang_url' => [
|
||||||
|
'name' => 'Show Lang Parameter For URL',
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
@ -139,7 +139,7 @@ class AdvModel extends AdvsAdvsEntryModel implements AdvInterface
|
|||||||
$foreign_currency[$currencyIn] = $price * $rate;
|
$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'));
|
$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) {
|
$query = $query->leftJoin('advs_advs_translations', function ($join) {
|
||||||
$join->on('advs_advs.id', '=', 'advs_advs_translations.entry_id');
|
$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'])) {
|
if (!empty($param['keyword'])) {
|
||||||
@ -91,16 +91,26 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$country = isset($param['country']) ?
|
if (!setting_value('visiosoft.module.location::hide_location_filter')) {
|
||||||
$param['country'] : setting_value('visiosoft.module.location::default_country');
|
$country = isset($param['country']) ? $param['country'] : setting_value('visiosoft.module.location::default_country');
|
||||||
if ($country) {
|
if ($country) {
|
||||||
$query = $query->where('country_id', $country);
|
$query = $query->where('country_id', $country);
|
||||||
}
|
}
|
||||||
if ($city) {
|
if ($city) {
|
||||||
$query = $query->where('city', $city->id);
|
$query = $query->where('city', $city->id);
|
||||||
} elseif (isset($param['city']) and !empty($param['city']) and !empty(array_filter($param['city']))) {
|
} elseif (isset($param['city']) and !empty(array_filter($param['city']))) {
|
||||||
$query = $query->whereIn('city', $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) {
|
if ($category) {
|
||||||
$cat = new CategoryModel();
|
$cat = new CategoryModel();
|
||||||
if ($category) {
|
if ($category) {
|
||||||
@ -116,15 +126,6 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
|
|||||||
if (!empty($param['user'])) {
|
if (!empty($param['user'])) {
|
||||||
$query = $query->where('advs_advs.created_by_id', $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'])) {
|
if (!empty($param['min_price'])) {
|
||||||
$num = $param['min_price'];
|
$num = $param['min_price'];
|
||||||
$int = (int)$num;
|
$int = (int)$num;
|
||||||
|
|||||||
@ -31,13 +31,19 @@ class redirectDiffrentLang
|
|||||||
|
|
||||||
public function handle(Request $request, Closure $next)
|
public function handle(Request $request, Closure $next)
|
||||||
{
|
{
|
||||||
|
if (setting_value('visiosoft.module.advs::show_lang_url')) {
|
||||||
$original_url = $request->server->get('ORIGINAL_REQUEST_URI');
|
$original_url = $request->server->get('ORIGINAL_REQUEST_URI');
|
||||||
$setting_language = setting_value('streams::default_locale');
|
$setting_language = setting_value('streams::default_locale');
|
||||||
$current_language = $request->session()->get('_locale', $setting_language);
|
$current_language = $request->session()->get('_locale', $setting_language);
|
||||||
$request_url = ltrim($request->getRequestUri(), '/');
|
$request_url = ltrim($request->getRequestUri(), '/');
|
||||||
|
|
||||||
|
$not_included = [
|
||||||
|
'admin',
|
||||||
|
'social'
|
||||||
|
];
|
||||||
|
|
||||||
// If the segment(1) is admin and language parameters is not null, no forwarding will be made.
|
// If the segment(1) is admin and language parameters is not null, no forwarding will be made.
|
||||||
if ($request->segment(1) == "admin" and in_array($current_language, explode('/', $original_url))) {
|
if (in_array($request->segment(1), $not_included) and in_array($current_language, explode('/', $original_url))) {
|
||||||
return $this->redirect->to($request->fullUrl());
|
return $this->redirect->to($request->fullUrl());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,11 +52,11 @@ class redirectDiffrentLang
|
|||||||
// If the method is get, no forwarding will be made.
|
// If the method is get, no forwarding will be made.
|
||||||
// If the segment(1) is admin, no forwarding will be made.
|
// If the segment(1) is admin, no forwarding will be made.
|
||||||
|
|
||||||
if ($request->method() == "GET" and $request->segment(1) != "admin" and $request_url != "" and $original_url != '/' . $current_language . '/' . $request_url) {
|
if ($request->method() == "GET" and !in_array($request->segment(1), $not_included) and $request_url != "" and $original_url != '/' . $current_language . '/' . $request_url) {
|
||||||
return $this->redirect->to('/' . $current_language . '/' . $request_url);
|
return $this->redirect->to('/' . $current_language . '/' . $request_url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user