feat(tenant): add main carousel images functionality with migration, model, and tests

This commit is contained in:
2026-07-23 14:19:00 -03:00
parent e778d862ba
commit 67ede1a2b4
9 changed files with 241 additions and 12 deletions

View File

@@ -73,6 +73,22 @@ class Tenant extends Model
return $this->belongsTo(Attachment::class, 'hero_bg_image_id');
}
/**
* @return BelongsToMany<Attachment, $this>
*/
public function mainCarouselImages(): BelongsToMany
{
return $this->belongsToMany(
Attachment::class,
'tenant_main_carousel_images',
'tenant_id',
'attachment_id'
)
->withPivot('orden')
->withTimestamps()
->orderByPivot('orden');
}
public function catalogItems(): HasMany
{
return $this->hasMany(CatalogItem::class, 'tenant_code', 'codigo');