Add variations, slider, fix cart ...
This commit is contained in:
@@ -24,12 +24,13 @@ class Category extends parentCategory
|
||||
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'categories';
|
||||
public $translatable = ['name', 'description'];
|
||||
public $translatable = [];
|
||||
protected $cascadeDeleteMorph = ['Articles'];
|
||||
protected $fillable = [
|
||||
'visible',
|
||||
'homepage',
|
||||
'slug',
|
||||
'name',
|
||||
'visible',
|
||||
'description',
|
||||
NestedSet::LFT,
|
||||
NestedSet::RGT,
|
||||
@@ -61,4 +62,14 @@ class Category extends parentCategory
|
||||
{
|
||||
return $query->where('visible', 1);
|
||||
}
|
||||
|
||||
public function scopeHomepage($query)
|
||||
{
|
||||
return $query->where('homepage', 1);
|
||||
}
|
||||
|
||||
public function scopeNotRoot($query)
|
||||
{
|
||||
return $query->where('id', '<>', 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,4 +150,35 @@ class Offer extends Model
|
||||
$query->active()->bySaleChannel($sale_channel_id);
|
||||
});
|
||||
}
|
||||
|
||||
public function scopeWithPriceListsBySaleChannel($query, $sale_channel_id)
|
||||
{
|
||||
return $query->with([
|
||||
'price_lists' => function($query) use ($sale_channel_id) {
|
||||
$query->bySaleChannel($sale_channel_id);
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
||||
public function scopeWithPriceListValuesBySaleChannel($query, $sale_channel_id)
|
||||
{
|
||||
return $query->with([
|
||||
'price_lists' => function($query) use ($sale_channel_id) {
|
||||
$query->bySaleChannel($sale_channel_id);
|
||||
},
|
||||
'price_lists.price_list_values',
|
||||
]);
|
||||
}
|
||||
|
||||
public function scopeWithPriceBySaleChannelByQuantity($query, $sale_channel_id, $quantity = 1)
|
||||
{
|
||||
return $query->with([
|
||||
'price_lists' => function($query) use ($sale_channel_id) {
|
||||
$query->bySaleChannel($sale_channel_id);
|
||||
},
|
||||
'price_lists.price_list_values' => function($query) use ($quantity) {
|
||||
$query->byQuantity($quantity);
|
||||
},
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user