feat(seeder): add FiestaTradicionArrufoSeeder to tenant provisioning and update OnTicketTenantSeeder for image validation

This commit is contained in:
2026-09-21 16:52:40 -03:00
parent f5f4cb4e87
commit a4a8a3ef8f
4 changed files with 68 additions and 6 deletions

View File

@@ -9,6 +9,7 @@ use App\Domains\Core\Tenant\Services\TenantProvisioningService;
use App\Domains\Core\Tenant\Services\WebsiteExtraService;
use Illuminate\Database\Seeder;
use Illuminate\Http\UploadedFile;
use Illuminate\Support\Facades\Storage;
use RuntimeException;
class OnTicketTenantSeeder extends Seeder
@@ -58,10 +59,22 @@ class OnTicketTenantSeeder extends Seeder
'display_seach_bar' => true,
]);
if ($tenant->header_bg_image_id === null) {
$tenant = $this->tenantProvisioningService->update($tenant, [
'header_bg_image' => $this->uploadedImage('onticket_header_background.png'),
]);
$missingImages = [];
foreach ([
'header_logo' => ['relation' => 'headerLogo', 'filename' => 'onticket_logo.png'],
'footer_logo' => ['relation' => 'footerLogo', 'filename' => 'onticket_footer_logo.png'],
'favicon' => ['relation' => 'favicon', 'filename' => 'onticket_favicon.svg'],
'header_bg_image' => ['relation' => 'headerBackgroundImage', 'filename' => 'onticket_header_background.png'],
] as $field => $image) {
$attachment = $tenant->{$image['relation']};
if ($attachment === null || ! Storage::disk('s3')->exists($attachment->path)) {
$missingImages[$field] = $this->uploadedImage($image['filename']);
}
}
if ($missingImages !== []) {
$tenant = $this->tenantProvisioningService->update($tenant, $missingImages);
}
}