From 8c666fd49205e872f7159594f0c197875d96f9b8 Mon Sep 17 00:00:00 2001 From: vedatakd Date: Tue, 15 Jun 2021 14:23:07 +0300 Subject: [PATCH 1/4] initial --- app/Exceptions/ExceptionHandler.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Exceptions/ExceptionHandler.php b/app/Exceptions/ExceptionHandler.php index 9f3f95065..898f1e84b 100644 --- a/app/Exceptions/ExceptionHandler.php +++ b/app/Exceptions/ExceptionHandler.php @@ -2,6 +2,7 @@ namespace App\Exceptions; +use Anomaly\Streams\Platform\Exception\ExceptionIdentifier; use Swift_TransportException; use Throwable; use Illuminate\Support\Facades\Auth; From 88342891f61594a2ea82283e365a379dad9bc15e Mon Sep 17 00:00:00 2001 From: vedatakd Date: Wed, 16 Jun 2021 18:44:17 +0300 Subject: [PATCH 2/4] change stream name --- resources/streams/config/translate.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/resources/streams/config/translate.php b/resources/streams/config/translate.php index 41135f165..b5b671eec 100644 --- a/resources/streams/config/translate.php +++ b/resources/streams/config/translate.php @@ -3,5 +3,7 @@ return [ 'override' => [ 'Sümüklüböcek:Benzersiz İsim', + 'Blocks:Advertising Spaces', + 'Bloklar:Reklam Alanları', ], ]; \ No newline at end of file From bcf326c7671282bf3d5f009addfa697b79f047c8 Mon Sep 17 00:00:00 2001 From: vedatakd Date: Fri, 18 Jun 2021 17:33:32 +0300 Subject: [PATCH 3/4] added attributes --- .../advs-module/src/Adv/AdvModel.php | 46 +++++++++++++++++-- .../advs-module/src/Adv/AdvRepository.php | 5 -- 2 files changed, 42 insertions(+), 9 deletions(-) diff --git a/addons/default/visiosoft/advs-module/src/Adv/AdvModel.php b/addons/default/visiosoft/advs-module/src/Adv/AdvModel.php index b7227eda5..189e30026 100644 --- a/addons/default/visiosoft/advs-module/src/Adv/AdvModel.php +++ b/addons/default/visiosoft/advs-module/src/Adv/AdvModel.php @@ -8,6 +8,7 @@ use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\DB; use Visiosoft\AdvsModule\Adv\Contract\AdvInterface; use Anomaly\Streams\Platform\Model\Advs\AdvsAdvsEntryModel; +use Visiosoft\AdvsModule\Support\Command\Currency; use Visiosoft\LocationModule\City\CityModel; use Visiosoft\LocationModule\Country\CountryModel; use Visiosoft\CartsModule\Cart\Command\GetCart; @@ -17,6 +18,45 @@ use Visiosoft\LocationModule\Village\Contract\VillageRepositoryInterface; class AdvModel extends AdvsAdvsEntryModel implements AdvInterface { + protected $appends = [ + 'detail_url', + 'currency_price', + 'cat1_name', + 'cat2_name', + 'thumbnail', + ]; + + public function getDetailUrlAttribute() + { + return $this->getAdvDetailLinkByModel($this, 'list'); + } + + public function getCurrencyPriceAttribute() + { + return app(Currency::class)->format($this->price, $this->currency); + } + + public function getCat1NameAttribute() + { + return $this->hasMany('Visiosoft\CatsModule\Category\CategoryModel', 'id', 'cat1')->first()->name; + + } + + public function getCat2NameAttribute() + { + return $this->hasMany('Visiosoft\CatsModule\Category\CategoryModel', 'id', 'cat1')->first()->name; + + } + + public function getThumbnailAttribute() + { + 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); + } + } + public function getTransNameAttribute() { if (is_null($this->name)) { @@ -278,12 +318,10 @@ class AdvModel extends AdvsAdvsEntryModel implements AdvInterface public function stockControl($id, $quantity) { - if($adv = $this->getAdv($id)) - { + if ($adv = $this->getAdv($id)) { $stock = $adv->stock; - if($stock and $stock >= $quantity) - { + if ($stock and $stock >= $quantity) { return 1; } } diff --git a/addons/default/visiosoft/advs-module/src/Adv/AdvRepository.php b/addons/default/visiosoft/advs-module/src/Adv/AdvRepository.php index 967f96c48..6ef80db7d 100644 --- a/addons/default/visiosoft/advs-module/src/Adv/AdvRepository.php +++ b/addons/default/visiosoft/advs-module/src/Adv/AdvRepository.php @@ -389,11 +389,6 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface $ads = $this->model->getLocationNames($latest_advs); - foreach ($ads as $index => $ad) { - $ads[$index]->detail_url = $this->model->getAdvDetailLinkByModel($ad, 'list'); - $ads[$index] = $this->model->AddAdsDefaultCoverImage($ad); - } - return $ads; } From bb150fabb46970e503f9acbb5def9a71ba2db7f2 Mon Sep 17 00:00:00 2001 From: vedatakd Date: Mon, 21 Jun 2021 12:30:09 +0300 Subject: [PATCH 4/4] category relation --- .../visiosoft/advs-module/src/Adv/AdvModel.php | 12 ++++++------ 1 file changed, 6 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 189e30026..8fd62f983 100644 --- a/addons/default/visiosoft/advs-module/src/Adv/AdvModel.php +++ b/addons/default/visiosoft/advs-module/src/Adv/AdvModel.php @@ -21,8 +21,8 @@ class AdvModel extends AdvsAdvsEntryModel implements AdvInterface protected $appends = [ 'detail_url', 'currency_price', - 'cat1_name', - 'cat2_name', + 'category1', + 'category2', 'thumbnail', ]; @@ -36,15 +36,15 @@ class AdvModel extends AdvsAdvsEntryModel implements AdvInterface return app(Currency::class)->format($this->price, $this->currency); } - public function getCat1NameAttribute() + public function getCategory1Attribute() { - return $this->hasMany('Visiosoft\CatsModule\Category\CategoryModel', 'id', 'cat1')->first()->name; + return $this->hasMany('Visiosoft\CatsModule\Category\CategoryModel', 'id', 'cat1')->first(); } - public function getCat2NameAttribute() + public function getCategory2Attribute() { - return $this->hasMany('Visiosoft\CatsModule\Category\CategoryModel', 'id', 'cat1')->first()->name; + return $this->hasMany('Visiosoft\CatsModule\Category\CategoryModel', 'id', 'cat1')->first(); }