feat: implement product and attachment management service with supporting migrations and API controllers

This commit is contained in:
2026-06-29 12:13:21 -03:00
parent cd420e02d8
commit 49771ebb13
8 changed files with 128 additions and 9 deletions

View File

@@ -2,6 +2,7 @@
namespace App\Domains\Catalog\Models;
use App\Domains\Attachable\Models\Attachment;
use App\Domains\Tenant\Models\Tenant;
use Illuminate\Database\Eloquent\Attributes\Fillable;
use Illuminate\Database\Eloquent\Factories\HasFactory;
@@ -61,6 +62,19 @@ class Product extends Model
)->withTimestamps();
}
/**
* @return BelongsToMany<Attachment, $this>
*/
public function attachments(): BelongsToMany
{
return $this->belongsToMany(
Attachment::class,
'productos_attachments',
'producto_id',
'attachment_id'
)->withTimestamps();
}
/**
* Create a variant for this product with its definitions.
*