From b60004ae1548574b03fd89b77ed05a51a3854225 Mon Sep 17 00:00:00 2001 From: Diatrex Date: Wed, 21 Oct 2020 18:01:21 +0300 Subject: [PATCH] =?UTF-8?q?#2436=20Ad=20post=20"L=C3=BCtfen=20Paket=20Sat?= =?UTF-8?q?=C4=B1n=20Al=C4=B1n!"=20error?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- addons/default/visiosoft/advs-module/src/Adv/AdvModel.php | 4 ++-- .../advs-module/src/Http/Controller/advsController.php | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/addons/default/visiosoft/advs-module/src/Adv/AdvModel.php b/addons/default/visiosoft/advs-module/src/Adv/AdvModel.php index bf879d2ad..e48dab82a 100644 --- a/addons/default/visiosoft/advs-module/src/Adv/AdvModel.php +++ b/addons/default/visiosoft/advs-module/src/Adv/AdvModel.php @@ -67,9 +67,9 @@ class AdvModel extends AdvsAdvsEntryModel implements AdvInterface return $query->where('advs_advs.slug', '!=', ""); } - public function userAdv($nullable_ad = false) + public function userAdv($nullable_ad = false, $checkRole = true) { - if (Auth::user()->hasRole('admin')) { + if (Auth::user()->hasRole('admin') && $checkRole) { return $this->getAdv(null, $nullable_ad); } else { return $this->getAdv(null, $nullable_ad) diff --git a/addons/default/visiosoft/advs-module/src/Http/Controller/advsController.php b/addons/default/visiosoft/advs-module/src/Http/Controller/advsController.php index 710bbbbce..788713470 100644 --- a/addons/default/visiosoft/advs-module/src/Http/Controller/advsController.php +++ b/addons/default/visiosoft/advs-module/src/Http/Controller/advsController.php @@ -667,8 +667,7 @@ class AdvsController extends PublicController CategoryRepositoryInterface $categoryRepository, Dispatcher $events, AdvModel $advModel, - AdressRepositoryInterface $address, - CategoryModel $categoryModel + AdressRepositoryInterface $address ) { if (!Auth::user()) { @@ -693,10 +692,10 @@ class AdvsController extends PublicController if ($advModel->is_enabled('packages') and $adv->slug == "") { $cat = app('Visiosoft\PackagesModule\Http\Controller\PackageFEController')->AdLimitForNewAd($request); if (!is_null($cat)) { - if (is_array($cat) && array_key_exists('allowPendingAds', $cat)) { + if (array_key_exists('allowPendingAds', $cat)) { $allowPendingAdCreation = $cat['allowPendingAds']; } else { - return redirect('/'); + return redirect($cat['redirect']); } } }