public function spa(Request $request) { $therapies_data = Therapies::get(); return view('ayurvedic_therapies', array('therapies' => $therapies_data)); }
public function therapyUpdate(Request $request, $updateId) { $name = Input::get('tname1'); //Get the therapy name $des = Input::get('tdes1'); //Get the description //Get the therapy details ,change and save the details try { $therapy = Therapies::whereId($updateId)->first(); $therapy->name = $name; $therapy->description = $des; $therapy->save(); if (isset(Input::file('profile_img')[0])) { /* This function will upload image */ self::upload_image($request, $updateId); /* Updates Database Images table Image_path with new path */ $ther_ob = Therapies::whereId($updateId)->first(); $ther_ob->image_path = "therapy_images/therapy_img_" . $updateId . ".png"; $ther_ob->save(); } $res['error'] = false; return response()->json($res); } catch (Exception $e) { $HTMLView = (string) view('errors.adminError'); $res['page'] = $HTMLView; $res['error'] = true; return response()->json($res); } }