File: D:/HostingSpaces/SBogers95/rentman.io/app/Komma/PricingLabels/PricingLabelController.php
<?php
namespace App\Komma\PricingLabels;
use App\Http\Controllers\Controller;
use App\Komma\PricingLabels\Models\PricingLabel;
class PricingLabelController extends Controller
{
/**
* Create export of the translatable variable of all the pricing labels
*
* @return \Illuminate\Http\JsonResponse
*/
public function oneSkyExport()
{
\App::changeLanguageByIso2('en');
$pricingLabels = PricingLabel::with('translations', 'translation')
->get();
$exportJson = [];
foreach ($pricingLabels as $pricingLabel) {
// Generate the page JSON
$pricingJson = $this->oneSkyExporterService->generateModelJson($pricingLabel, ['name']);
if (count($pricingJson) == 0) {
continue;
}
// Generate the components JSON
$exportJson[$pricingLabel->code_name] = $pricingJson;
}
return response()->json($exportJson);
}
}