feat(tenant): add main carousel images functionality with migration, model, and tests

This commit is contained in:
2026-07-23 14:19:00 -03:00
parent e778d862ba
commit 67ede1a2b4
9 changed files with 241 additions and 12 deletions

View File

@@ -13,32 +13,41 @@ use Illuminate\Http\Response;
class TenantController extends Controller
{
public function __construct(protected TenantService $tenantService)
{
}
public function __construct(protected TenantService $tenantService) {}
public function index(): JsonResponse
{
return TenantResource::collection(Tenant::query()->with(['headerLogo', 'footerLogo'])->latest()->paginateFromRequest())->response();
return TenantResource::collection(
Tenant::query()
->with(['headerLogo', 'footerLogo', 'mainCarouselImages'])
->latest()
->paginateFromRequest()
)->response();
}
public function store(StoreTenantRequest $request): JsonResponse
{
$tenant = $this->tenantService->create($request->validated());
return TenantResource::make($tenant->loadMissing(['headerLogo', 'footerLogo']))->response()->setStatusCode(201);
return TenantResource::make(
$tenant->loadMissing(['headerLogo', 'footerLogo', 'mainCarouselImages'])
)->response()->setStatusCode(201);
}
public function show(Tenant $tenant): TenantResource
{
return TenantResource::make($tenant->loadMissing(['headerLogo', 'footerLogo']));
return TenantResource::make(
$tenant->loadMissing(['headerLogo', 'footerLogo', 'mainCarouselImages'])
);
}
public function update(UpdateTenantRequest $request, Tenant $tenant): TenantResource
{
$tenant = $this->tenantService->update($tenant, $request->validated());
return TenantResource::make($tenant->loadMissing(['headerLogo', 'footerLogo']));
return TenantResource::make(
$tenant->loadMissing(['headerLogo', 'footerLogo', 'mainCarouselImages'])
);
}
public function destroy(Tenant $tenant): Response