feat: add hero background image functionality to Tenant model and related requests, resources, and seeder

This commit is contained in:
2026-07-14 13:58:49 -03:00
parent b4b888adef
commit 38f36a3a23
8 changed files with 108 additions and 5 deletions

View File

@@ -15,6 +15,12 @@ class TenantResource extends JsonResource
*/
public function toArray(Request $request): array
{
$heroConfig = $this->hero_config;
if (is_array($heroConfig)) {
$heroConfig['background_image'] = $this->heroBgImage?->getTemporaryUrl(1440);
unset($heroConfig['background_image_id']);
}
return [
'id' => $this->id,
'codigo' => $this->codigo,
@@ -29,7 +35,7 @@ class TenantResource extends JsonResource
// 1 day
'header_logo' => $this->headerLogo?->getTemporaryUrl(1440),
'footer_logo' => $this->footerLogo?->getTemporaryUrl(1440 ),
'hero_config' => $this->hero_config,
'hero_config' => $heroConfig,
'event_config' => $this->event_config,
'menues' => $this->whenLoaded('menues'),
];