From 494f9defc039e0e0f3381f96553f85f96e3dfd7e Mon Sep 17 00:00:00 2001 From: Muammer Top Date: Wed, 10 Nov 2021 14:23:24 +0300 Subject: [PATCH] #4857 add video in ad-detail slider for emlak24 --- .../advs-module/src/Adv/AdvModel.php | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/addons/default/visiosoft/advs-module/src/Adv/AdvModel.php b/addons/default/visiosoft/advs-module/src/Adv/AdvModel.php index e22271646..8e1506617 100644 --- a/addons/default/visiosoft/advs-module/src/Adv/AdvModel.php +++ b/addons/default/visiosoft/advs-module/src/Adv/AdvModel.php @@ -28,6 +28,7 @@ class AdvModel extends AdvsAdvsEntryModel implements AdvInterface 'currency_standard_price', 'category2', 'thumbnail', + 'video', ]; protected $cascades = [ @@ -82,9 +83,24 @@ class AdvModel extends AdvsAdvsEntryModel implements AdvInterface { if ($this->cover_photo == null) { return $this->dispatch(new MakeImageInstance('visiosoft.theme.base::images/no-image.png', 'img'))->url(); - } else { - return url($this->cover_photo); } + + return url($this->cover_photo); + } + + public function getVideoAttribute() + { + if (is_module_installed('visiosoft.module.cloudinary')) { + $url = app('Visiosoft\CloudinaryModule\Http\Controller\VideoController')->getVideoUrl($this->id); + $thumbnail = str_replace('mp4', 'jpg', $url); + + return [ + 'url' => $url, + 'thumbnail' => $thumbnail, + ]; + } + + return null; } public function getTransNameAttribute()