refactor(catalog): Complete catalog refactor to simplify its data model and its querying.
source commits: refactor/catalog
This commit is contained in:
32
app/Domains/Catalog/Models/VariantDefinition.php
Normal file
32
app/Domains/Catalog/Models/VariantDefinition.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Catalog\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
#[Fillable([
|
||||
'variant_id',
|
||||
'item_attribute_id',
|
||||
'value',
|
||||
])]
|
||||
class VariantDefinition extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'variant_values';
|
||||
|
||||
/** @return BelongsTo<Variant, $this> */
|
||||
public function variant(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Variant::class);
|
||||
}
|
||||
|
||||
/** @return BelongsTo<ItemAttribute, $this> */
|
||||
public function itemAttribute(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(ItemAttribute::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user