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']); } } }