#2436 Ad post "Lütfen Paket Satın Alın!" error

This commit is contained in:
Diatrex 2020-10-21 18:01:21 +03:00
parent 537d9dc9f8
commit b60004ae15
2 changed files with 5 additions and 6 deletions

View File

@ -67,9 +67,9 @@ class AdvModel extends AdvsAdvsEntryModel implements AdvInterface
return $query->where('advs_advs.slug', '!=', ""); 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); return $this->getAdv(null, $nullable_ad);
} else { } else {
return $this->getAdv(null, $nullable_ad) return $this->getAdv(null, $nullable_ad)

View File

@ -667,8 +667,7 @@ class AdvsController extends PublicController
CategoryRepositoryInterface $categoryRepository, CategoryRepositoryInterface $categoryRepository,
Dispatcher $events, Dispatcher $events,
AdvModel $advModel, AdvModel $advModel,
AdressRepositoryInterface $address, AdressRepositoryInterface $address
CategoryModel $categoryModel
) )
{ {
if (!Auth::user()) { if (!Auth::user()) {
@ -693,10 +692,10 @@ class AdvsController extends PublicController
if ($advModel->is_enabled('packages') and $adv->slug == "") { if ($advModel->is_enabled('packages') and $adv->slug == "") {
$cat = app('Visiosoft\PackagesModule\Http\Controller\PackageFEController')->AdLimitForNewAd($request); $cat = app('Visiosoft\PackagesModule\Http\Controller\PackageFEController')->AdLimitForNewAd($request);
if (!is_null($cat)) { if (!is_null($cat)) {
if (is_array($cat) && array_key_exists('allowPendingAds', $cat)) { if (array_key_exists('allowPendingAds', $cat)) {
$allowPendingAdCreation = $cat['allowPendingAds']; $allowPendingAdCreation = $cat['allowPendingAds'];
} else { } else {
return redirect('/'); return redirect($cat['redirect']);
} }
} }
} }