This commit is contained in:
Diatrex 2020-09-07 13:10:18 +03:00
parent 1111aefa15
commit aacd3fa83a
2 changed files with 71 additions and 68 deletions

View File

@ -292,7 +292,9 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
->inRandomOrder()
->first();
if ($adv) {
$adv = $this->getLocationNames($adv);
}
return $adv;
}

View File

@ -343,17 +343,14 @@ class AdvsController extends PublicController
{
$id = is_null($id) ? $seo : $id;
$categories = array();
$categories_id = array();
$isActiveComplaints = $this->adv_model->is_enabled('complaints');
$isCommentActive = $this->adv_model->is_enabled('comments');
$adv = $this->adv_repository->getListItemAdv($id);
if ($isActiveComplaints) {
if ($adv) {
if ($this->adv_model->is_enabled('complaints')) {
$complaints = ComplaintsComplainTypesEntryModel::all();
}
$adv = $this->adv_repository->getListItemAdv($id);
$recommended_advs = $this->adv_repository->getRecommendedAds($adv->id);
foreach ($recommended_advs as $index => $ad) {
@ -361,6 +358,8 @@ class AdvsController extends PublicController
$recommended_advs[$index] = $this->adv_model->AddAdsDefaultCoverImage($ad);
}
$categories = array();
$categories_id = array();
for ($i = 1; $i <= 10; $i++) {
$cat = "cat" . $i;
if ($adv->$cat != null) {
@ -382,8 +381,7 @@ class AdvsController extends PublicController
//Cloudinary Module
$adv->video_url = null;
$isActiveCloudinary = $this->adv_model->is_enabled('cloudinary');
if ($isActiveCloudinary) {
if ($this->adv_model->is_enabled('cloudinary')) {
$CloudinaryModel = new VideoModel();
$Cloudinary = $CloudinaryModel->getVideo($id);
@ -395,7 +393,7 @@ class AdvsController extends PublicController
$options = $this->optionRepository->findAllBy('adv_id', $id);
if ($isCommentActive) {
if ($this->adv_model->is_enabled('comments')) {
$CommentModel = new CommentModel();
$comments = $CommentModel->getComments($adv->id)->get();
}
@ -425,7 +423,10 @@ class AdvsController extends PublicController
} else {
return back();
}
} else {
$this->messages->error(trans('visiosoft.module.advs::message.ad_doesnt_exist'));
return redirect()->route('visiosoft.module.advs::list');
}
}
public function preview($id)