public function getPricing() { $priceMethod = SiteConfig::whereParameter('priceMethod')->first(); if ($priceMethod->data == 'fixedRatio') { $prices = SiteConfig::where('parameter', 'LIKE', '%Price')->get(); } else { if ($priceMethod->data == 'elementPrice') { $prices = ElementPrice::whereActive('1')->get(); } } return response()->json(['priceMethod' => $priceMethod->data, 'prices' => $prices->toArray()]); }
public function index() { $priceMethod = SiteConfig::whereParameter('priceMethod')->first(); $storageTypes = StorageType::whereActive('1')->get(); $prices = SiteConfig::where('parameter', 'LIKE', '%Price')->get(); $ratioPrices = array(); if ($prices->count() > 0) { foreach ($prices as $price) { $ratioPrices[$price->parameter] = $price->data; } } $elementPrices = ElementPrice::whereActive('1')->orderBy('element')->get(); return view('prices.index')->with(compact('priceMethod', 'storageTypes', 'ratioPrices', 'elementPrices')); }