feat(seeder): add FiestaTradicionArrufoSeeder to tenant provisioning and update OnTicketTenantSeeder for image validation
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user