/**
  * Post profile page
  * @param type int $id
  * @param type ProfileRequest $request
  * @return type Response
  */
 public function postProfile($id, ProfileRequest $request)
 {
     $user = Auth::user();
     $user->gender = $request->input('gender');
     $user->save();
     if ($user->profile_pic == 'avatar5.png' || $user->profile_pic == 'avatar2.png') {
         if ($request->input('gender') == 1) {
             $name = 'avatar5.png';
             $destinationPath = 'lb-faveo/profilepic';
             $user->profile_pic = $name;
         } elseif ($request->input('gender') == 0) {
             $name = 'avatar2.png';
             $destinationPath = 'lb-faveo/profilepic';
             $user->profile_pic = $name;
         }
     }
     if (Input::file('profile_pic')) {
         //$extension = Input::file('profile_pic')->getClientOriginalExtension();
         $name = Input::file('profile_pic')->getClientOriginalName();
         $destinationPath = 'lb-faveo/profilepic';
         $fileName = rand(00, 9999) . '.' . $name;
         //echo $fileName;
         Input::file('profile_pic')->move($destinationPath, $fileName);
         $user->profile_pic = $fileName;
     } else {
         $user->fill($request->except('profile_pic', 'gender'))->save();
         return redirect('guest')->with('success', 'Profile Updated sucessfully');
     }
     if ($user->fill($request->except('profile_pic'))->save()) {
         return redirect('guest')->with('success', 'Profile Updated sucessfully');
     }
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function update(ProfileRequest $request, $id)
 {
     $request_data = $request->except('_method', '_token');
     if ($request->hasFile('image_file')) {
         $path = storage_path('app/profiles/' . Auth::user()->profile->id . '/profile_picture/');
         $image_file = $request_data['image_file'];
         unset($request_data['image_file']);
         $request_data['image_name'] = $this->generateImagename($image_file->getClientOriginalExtension());
         $request_data['mime_type'] = $image_file->getClientMimeType();
         $this->saveImage($path, $image_file, $request_data['image_name']);
     }
     $profile = Auth::user()->profile()->update($request_data);
     return redirect('profiles');
 }