public function edit($id) { $element = ElementPrice::findOrFail($id); $storageTypes = StorageType::whereActive('1')->get(); $elements = ['CPU' => 'CPU Cores', 'RAM' => "RAM"]; foreach ($storageTypes as $st) { $elements[$st->tag] = "{$st->storage_type} - {$st->tag}"; } return view('prices.edit')->with(compact('element', 'elements')); }
public function syncACS() { $acs = app('cloudstack'); if (is_array($acs)) { return -1; } $offerings = $acs->listDiskOfferings(); $tags = []; foreach ($offerings as $offering) { // Extract a list of tags if (!isset($offering->tags)) { continue; } if (!in_array($offering->tags, $tags)) { $tags[] = $offering->tags; } } foreach ($tags as $tag) { // Create a config price and a storage tag if they don't exist. StorageType::firstOrCreate(['tag' => $tag]); SiteConfig::firstOrCreate(['parameter' => $tag . 'Price']); } return 1; }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { // $st = StorageType::findOrFail($id); $st->delete(); return 1; }