HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers95/rentman.io/app/Komma/ProductGroups/ProductGroupController.php
<?php

namespace App\Komma\ProductGroups;

use App\Http\Controllers\Controller;
use App\Komma\ProductGroups\Models\ProductGroup;

class ProductGroupController extends Controller
{
    /**
     * Create export of the translatable variable of all the product groups
     *
     * @return \Illuminate\Http\JsonResponse
     */
    public function oneSkyExport()
    {
        \App::changeLanguageByIso2('en');

        $productGroups = ProductGroup::with('translations', 'translation')
            ->get();

        $exportJson = [];

        foreach ($productGroups as $productGroup) {
            // Generate the page JSON
            $pricingJson = $this->oneSkyExporterService->generateModelJson($productGroup, ['name']);

            if (count($pricingJson) == 0) {
                continue;
            }

            // Generate the components JSON
            $exportJson['product_group_'.$productGroup->id] = $pricingJson;
        }

        return response()->json($exportJson);
    }
}