refactor(catalog): Complete catalog refactor to simplify its data model and its querying.
source commits: refactor/catalog
This commit is contained in:
@@ -9,7 +9,6 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasManyThrough;
|
||||
|
||||
#[Fillable([
|
||||
'tenant_codigo',
|
||||
@@ -52,27 +51,4 @@ class Attribute extends Model
|
||||
{
|
||||
return $this->hasMany(AttributeOption::class, 'attribute_id')->orderBy('sort_order');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return HasMany<ProductAttribute, $this>
|
||||
*/
|
||||
public function productAttributes(): HasMany
|
||||
{
|
||||
return $this->hasMany(ProductAttribute::class, 'attribute_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return HasManyThrough<ProductVariantDefinition, ProductAttribute, $this>
|
||||
*/
|
||||
public function variantDefinitions(): HasManyThrough
|
||||
{
|
||||
return $this->hasManyThrough(
|
||||
ProductVariantDefinition::class,
|
||||
ProductAttribute::class,
|
||||
'attribute_id',
|
||||
'products_attribute_id',
|
||||
'id',
|
||||
'id'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user