diff --git a/app/Domains/Bootstrap/Resources/AdminAppBootstrapResource.php b/app/Domains/Bootstrap/Resources/AdminAppBootstrapResource.php index 296e284..63ba328 100644 --- a/app/Domains/Bootstrap/Resources/AdminAppBootstrapResource.php +++ b/app/Domains/Bootstrap/Resources/AdminAppBootstrapResource.php @@ -30,6 +30,7 @@ class AdminAppBootstrapResource extends JsonResource 'login_header_footer_color' => $websiteType->login_header_footer_color, 'site_logo' => $websiteType->siteLogo?->getTemporaryUrl(1440), 'footer_logo' => $websiteType->footerLogo?->getTemporaryUrl(1440), + 'favicon' => $websiteType->favicon?->getTemporaryUrl(1440), ]; } } diff --git a/app/Domains/Bootstrap/Services/AdminAppBootstrapService.php b/app/Domains/Bootstrap/Services/AdminAppBootstrapService.php index 572579a..743f4a0 100644 --- a/app/Domains/Bootstrap/Services/AdminAppBootstrapService.php +++ b/app/Domains/Bootstrap/Services/AdminAppBootstrapService.php @@ -11,7 +11,7 @@ class AdminAppBootstrapService { return [ 'website_type' => WebsiteType::query() - ->with(['siteLogo', 'footerLogo']) + ->with(['siteLogo', 'footerLogo', 'favicon']) ->where('dominio', $domain) ->firstOrFail(), ]; diff --git a/app/Domains/Bootstrap/Services/ScannerBootstrapService.php b/app/Domains/Bootstrap/Services/ScannerBootstrapService.php index 392c477..4a088a1 100644 --- a/app/Domains/Bootstrap/Services/ScannerBootstrapService.php +++ b/app/Domains/Bootstrap/Services/ScannerBootstrapService.php @@ -11,7 +11,7 @@ class ScannerBootstrapService { return [ 'website_type' => WebsiteType::query() - ->with(['siteLogo', 'footerLogo']) + ->with(['siteLogo', 'footerLogo', 'favicon']) ->where('scanner_domain', $domain) ->firstOrFail(), ]; diff --git a/tests/Feature/Tenant/BootstrapAdminAppControllerTest.php b/tests/Feature/Tenant/BootstrapAdminAppControllerTest.php index c64940b..9912805 100644 --- a/tests/Feature/Tenant/BootstrapAdminAppControllerTest.php +++ b/tests/Feature/Tenant/BootstrapAdminAppControllerTest.php @@ -14,6 +14,7 @@ class BootstrapAdminAppControllerTest extends TestCase public function test_it_publicly_bootstraps_the_admin_app_by_domain(): void { $footerLogo = Attachment::factory()->create(); + $favicon = Attachment::factory()->create(); WebsiteType::query()->create([ 'codigo' => 'shopit', @@ -31,6 +32,7 @@ class BootstrapAdminAppControllerTest extends TestCase 'border_color' => '#eaeaea', 'login_header_footer_color' => '#313131', 'footer_logo' => $footerLogo->id, + 'favicon_id' => $favicon->id, ]); $this->getJson('/api/v1/adminapp/bootstrap/ADMIN.SHOPIT.TEST') @@ -41,6 +43,7 @@ class BootstrapAdminAppControllerTest extends TestCase ->assertJsonPath('data.login_header_footer_color', '#313131') ->assertJsonPath('data.site_logo', null) ->assertJsonPath('data.footer_logo', $footerLogo->getTemporaryUrl(1440)) + ->assertJsonPath('data.favicon', $favicon->getTemporaryUrl(1440)) ->assertJsonMissingPath('data.forms') ->assertJsonMissingPath('data.codigo') ->assertJsonMissingPath('data.nombre') diff --git a/tests/Feature/Tenant/BootstrapScannerControllerTest.php b/tests/Feature/Tenant/BootstrapScannerControllerTest.php index e4eb18f..c40c9e1 100644 --- a/tests/Feature/Tenant/BootstrapScannerControllerTest.php +++ b/tests/Feature/Tenant/BootstrapScannerControllerTest.php @@ -14,6 +14,7 @@ class BootstrapScannerControllerTest extends TestCase public function test_it_publicly_bootstraps_the_scanner_by_scanner_domain(): void { $siteLogo = Attachment::factory()->create(); + $favicon = Attachment::factory()->create(); WebsiteType::query()->create([ 'codigo' => 'shopit', @@ -32,6 +33,7 @@ class BootstrapScannerControllerTest extends TestCase 'border_color' => '#eaeaea', 'login_header_footer_color' => '#313131', 'site_logo' => $siteLogo->id, + 'favicon_id' => $favicon->id, ]); $this->getJson('/api/v1/scanner/bootstrap/SCANNER.SHOPIT.TEST') @@ -40,6 +42,7 @@ class BootstrapScannerControllerTest extends TestCase ->assertJsonPath('data.primary_color', '#112233') ->assertJsonPath('data.site_logo', $siteLogo->getTemporaryUrl(1440)) ->assertJsonPath('data.footer_logo', null) + ->assertJsonPath('data.favicon', $favicon->getTemporaryUrl(1440)) ->assertJsonMissingPath('data.codigo') ->assertJsonMissingPath('data.nombre') ->assertJsonMissingPath('data.dominio') diff --git a/tests/Unit/Bootstrap/AdminAppBootstrapResourceTest.php b/tests/Unit/Bootstrap/AdminAppBootstrapResourceTest.php index eb142f6..7a01e39 100644 --- a/tests/Unit/Bootstrap/AdminAppBootstrapResourceTest.php +++ b/tests/Unit/Bootstrap/AdminAppBootstrapResourceTest.php @@ -17,11 +17,13 @@ class AdminAppBootstrapResourceTest extends TestCase ]); $websiteType->setRelation('siteLogo', null); $websiteType->setRelation('footerLogo', null); + $websiteType->setRelation('favicon', null); $data = AdminAppBootstrapResource::make([ 'website_type' => $websiteType, ])->resolve(request()); $this->assertSame('shopit', $data['website_type_code']); + $this->assertNull($data['favicon']); $this->assertArrayNotHasKey('forms', $data); } }