public function editImage($id) { //authorization if (!$this->adminAuth() && !$this->userAuth(Auth::User()->id)) { return view('errors.404'); } $user = Generalinfo::where('user_id', $id)->get(); return view('generalinfos.editimage', compact('user')); }
/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update($id) { // $v = Validator::make(Request::all(), ['city' => 'required|max:30', 'dob' => 'required', 'phone' => 'required']); if ($v->fails()) { return redirect()->back()->withErrors($v->errors())->withInput(); } else { $userId = Request::get('id'); $gInfo = Generalinfo::where('user_id', $userId)->get(); $gInfoId = $gInfo[0]->id; $gInfo = Generalinfo::find($gInfoId); $gInfo->country_id = Request::get('country'); $gInfo->city = Request::get('city'); $gInfo->dob = Request::get('dob'); $gInfo->image = Request::get('image'); $gInfo->address = Request::get('address'); $gInfo->phone = Request::get('phone'); $gInfo->anotherphone = Request::get('anotherphone'); $gInfo->skypename = Request::get('skypename'); $gInfo->howhearaboutus = Request::get('howhearaboutus'); $gInfo->save(); $interestId = Request::get('interest'); // UserInterest::where('user_id',$userId)->update['interest_id'=>$interestId]; UserInterest::where('user_id', $userId)->update(['interest_id' => $interestId]); return redirect('generalinfos/' . $userId); } }