public function postVote(Request $request)
 {
     if (!Auth::id()) {
         return response()->json(['message' => 'user not found'], 400);
     }
     $profile = Profile::where("id", "=", $request->input("profileId"))->first();
     if (!$profile || $profile->isActive != 1) {
         return response()->json(['message' => 'profile not found'], 400);
     }
     $image_file = $request->file('image');
     if (!$image_file) {
         return response()->json(['message' => 'resource not found'], 400);
     }
     $image = Image::create();
     $image_file->move(storage_path(), md5($image->id));
     $img = ImageIntervention::make(storage_path() . '/' . md5($image->id));
     $img->resize(1000, 1000, function ($constraint) {
         $constraint->aspectRatio();
         $constraint->upsize();
     });
     $img->save(base_path() . '/public/images/votes/' . md5($image->id) . '.jpg', 100);
     $img = ImageIntervention::make(storage_path() . '/' . md5($image->id));
     $img->fit(80, 80);
     $img->save(base_path() . '/public/images/votes/thumb_80_' . md5($image->id) . '.jpg', 100);
     $img = ImageIntervention::make(storage_path() . '/' . md5($image->id));
     $img->fit(132, 99);
     $img->save(base_path() . '/public/images/votes/thumb_132_' . md5($image->id) . '.jpg', 100);
     $vote = Vote::firstOrCreate(['user_id' => Auth::id(), 'profile_id' => $request->input("profileId")]);
     $vote->user_id = Auth::id();
     $vote->profile_id = $request->input("profileId");
     $vote->photo = md5($image->id);
     $vote->save();
     //$request->session()->push('uploaded_images', $image->id);
     return response()->json(['message' => 'created', 'path' => '/images/votes/thumb_80_' . md5($image->id) . '.jpg', 'imageId' => $request->input("imageId")], 201);
 }