feat: implement Attachment domain for file storage and integrate into Tenant service for logo management

This commit is contained in:
2026-06-29 09:43:46 -03:00
parent 67bc9e6cb4
commit b0508d79b3
9 changed files with 2 additions and 179 deletions

View File

@@ -3,7 +3,6 @@
namespace App\Domains\Tenant\Models;
use App\Domains\Attachable\Models\Attachment;
use App\Domains\Attachable\Models\Concerns\HasAttachments;
use App\Domains\Catalog\Models\Product;
use Illuminate\Database\Eloquent\Attributes\Fillable;
use Illuminate\Database\Eloquent\Factories\HasFactory;
@@ -24,7 +23,6 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
])]
class Tenant extends Model
{
use HasAttachments;
use HasFactory;
public function getRouteKeyName(): string

View File

@@ -55,14 +55,6 @@ class TenantService
/** @var Tenant $tenant */
$tenant = Tenant::query()->create($data);
if ($headerAttachmentId) {
$tenant->attachments()->attach($headerAttachmentId);
}
if ($footerAttachmentId) {
$tenant->attachments()->attach($footerAttachmentId);
}
return $tenant;
});
}
@@ -94,7 +86,6 @@ class TenantService
if ($attachment) {
$tenant->header_logo_id = $attachment->id;
$tenant->attachments()->attach($attachment->id);
} else {
$tenant->header_logo_id = null;
}
@@ -111,7 +102,6 @@ class TenantService
if ($attachment) {
$tenant->footer_logo_id = $attachment->id;
$tenant->attachments()->attach($attachment->id);
} else {
$tenant->footer_logo_id = null;
}