feat: implement product management module with CRUD operations, service layer, and validation logic

This commit is contained in:
2026-06-30 09:50:40 -03:00
parent f664fbe2dc
commit 72261bf422
5 changed files with 125 additions and 8 deletions

View File

@@ -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;
}
}