Merge pull request #1096 from openclassify/vedatakdogan

fixed use
This commit is contained in:
Dia Shalabi 2021-06-21 13:04:55 +03:00 committed by GitHub
commit f4bf29d797
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 45 additions and 9 deletions

View File

@ -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',
'category1',
'category2',
'thumbnail',
];
public function getDetailUrlAttribute()
{
return $this->getAdvDetailLinkByModel($this, 'list');
}
public function getCurrencyPriceAttribute()
{
return app(Currency::class)->format($this->price, $this->currency);
}
public function getCategory1Attribute()
{
return $this->hasMany('Visiosoft\CatsModule\Category\CategoryModel', 'id', 'cat1')->first();
}
public function getCategory2Attribute()
{
return $this->hasMany('Visiosoft\CatsModule\Category\CategoryModel', 'id', 'cat1')->first();
}
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;
}
}

View File

@ -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;
}

View File

@ -2,6 +2,7 @@
namespace App\Exceptions;
use Anomaly\Streams\Platform\Exception\ExceptionIdentifier;
use Swift_TransportException;
use Throwable;
use Illuminate\Support\Facades\Auth;

View File

@ -3,5 +3,7 @@
return [
'override' => [
'Sümüklüböcek:Benzersiz İsim',
'Blocks:Advertising Spaces',
'Bloklar:Reklam Alanları',
],
];