fix on payment by cb
This commit is contained in:
@@ -57,17 +57,12 @@ class Article extends Model implements HasMedia
|
||||
return $this->belongsTo(ArticleNature::class);
|
||||
}
|
||||
|
||||
public function invoiceItems(): HasMany
|
||||
{
|
||||
return $this->hasMany(InvoiceItem::class);
|
||||
}
|
||||
|
||||
public function offers(): HasMany
|
||||
{
|
||||
return $this->hasMany(Offer::class);
|
||||
}
|
||||
|
||||
public function price_lists(): HasManyDeep
|
||||
public function price_lists()
|
||||
{
|
||||
return $this->hasManyDeep(
|
||||
PriceList::class,
|
||||
@@ -77,7 +72,7 @@ class Article extends Model implements HasMedia
|
||||
);
|
||||
}
|
||||
|
||||
public function prices(): HasManyDeep
|
||||
public function prices()
|
||||
{
|
||||
return $this->hasManyDeep(
|
||||
PriceListValue::class,
|
||||
@@ -166,6 +161,16 @@ class Article extends Model implements HasMedia
|
||||
return $query->byProduct(Merchandise::class);
|
||||
}
|
||||
|
||||
public function scopeVisible($query)
|
||||
{
|
||||
return $query->where($this->table.'.visible', 1);
|
||||
}
|
||||
|
||||
public function scopeHomepage($query)
|
||||
{
|
||||
return $query->where($this->table.'.homepage', 1);
|
||||
}
|
||||
|
||||
public function scopeByProduct($query, $model)
|
||||
{
|
||||
return $model ? $query->where($this->table.'.product_type', $model) : $query;
|
||||
@@ -179,23 +184,14 @@ class Article extends Model implements HasMedia
|
||||
public function scopeByTag($query, $tagId)
|
||||
{
|
||||
return $tagId ? $query->whereHas('tags', function ($query) use ($tagId) {
|
||||
$query->where('id', $tagId);
|
||||
$query->byId($tagId);
|
||||
}) : $query;
|
||||
}
|
||||
|
||||
public function scopeByTags($query, $tags)
|
||||
{
|
||||
return $tags ? $query->whereHas('tags', function ($query) use ($tags) {
|
||||
$query->whereIn('id', $tags);
|
||||
}) : $query;
|
||||
}
|
||||
|
||||
public function scopeByTagsSelected($query, $tags)
|
||||
{
|
||||
return $tags ? $query->whereHas('tags', function ($query) use ($tags) {
|
||||
foreach ($tags as $tag) {
|
||||
$query->where('id', $tag);
|
||||
}
|
||||
$query->byIds($tags);
|
||||
}) : $query;
|
||||
}
|
||||
|
||||
@@ -210,14 +206,4 @@ class Article extends Model implements HasMedia
|
||||
$query->active()->byStockAvailable()->bySaleChannel($saleChannelId);
|
||||
});
|
||||
}
|
||||
|
||||
public function scopeVisible($query)
|
||||
{
|
||||
return $query->where($this->table.'.visible', 1);
|
||||
}
|
||||
|
||||
public function scopeHomepage($query)
|
||||
{
|
||||
return $query->where($this->table.'.homepage', 1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user