feat: implement product management module with CRUD operations, service layer, and validation logic
This commit is contained in:
@@ -27,7 +27,8 @@ class Product extends Model
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'productos';
|
||||
|
||||
|
||||
protected ?ProductVariant $defaultVariant = null;
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
@@ -274,4 +275,16 @@ class Product extends Model
|
||||
$attribute->options()->delete();
|
||||
$attribute->delete();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function setDefaultVariant(ProductVariant $variant): void
|
||||
{
|
||||
$this->defaultVariant = $variant;
|
||||
}
|
||||
|
||||
public function getDefaultVariant(): ?ProductVariant
|
||||
{
|
||||
return $this->defaultVariant;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user