public function getIndex()
 {
     $profile = Profile::firstOrCreate(['user_id' => Auth::id()]);
     if ($profile && $profile->isActive == 1) {
         return redirect('/profile/index/' . $profile->id);
     }
     return redirect()->action('HomeController@getGameOver');
     if ($profile->shortLink == "") {
         $profile->user_id = Auth::id();
         $profile->shortLink = shortenUrl($_ENV['BASE_FB_URL'] . 'profile/index/' . $profile->id);
     }
     $profile->save();
     $data = array('selectedPage' => 2);
     return view('register.index', $data);
 }
 public function postRemove(Request $request)
 {
     if (!Auth::id()) {
         return response()->json(['message' => 'user not found'], 400);
     }
     $imageId = $request->input("imageId");
     if ($imageId < 1 || $imageId > 5) {
         return response()->json(['message' => 'resource not found'], 400);
     }
     $profile = Profile::firstOrCreate(['user_id' => Auth::id()]);
     $profile->user_id = Auth::id();
     switch ($request->input("imageId")) {
         case 1:
             unlink(public_path() . generatePhotoURL('full', $profile->photo1));
             unlink(public_path() . generatePhotoURL('thumb_80', $profile->photo1));
             unlink(public_path() . generatePhotoURL('thumb_180', $profile->photo1));
             $profile->photo1 = '';
             break;
         case 2:
             unlink(public_path() . generatePhotoURL('full', $profile->photo2));
             unlink(public_path() . generatePhotoURL('thumb_80', $profile->photo2));
             unlink(public_path() . generatePhotoURL('thumb_180', $profile->photo2));
             $profile->photo2 = '';
             break;
         case 3:
             unlink(public_path() . generatePhotoURL('full', $profile->photo3));
             unlink(public_path() . generatePhotoURL('thumb_80', $profile->photo3));
             unlink(public_path() . generatePhotoURL('thumb_180', $profile->photo3));
             $profile->photo3 = '';
             break;
         case 4:
             unlink(public_path() . generatePhotoURL('full', $profile->photo4));
             unlink(public_path() . generatePhotoURL('thumb_80', $profile->photo4));
             unlink(public_path() . generatePhotoURL('thumb_180', $profile->photo4));
             $profile->photo4 = '';
             break;
         case 5:
             unlink(public_path() . generatePhotoURL('full', $profile->photo5));
             unlink(public_path() . generatePhotoURL('thumb_80', $profile->photo5));
             unlink(public_path() . generatePhotoURL('thumb_180', $profile->photo5));
             $profile->photo5 = '';
             break;
     }
     $profile->save();
     //$request->session()->push('uploaded_images', $image->id);
     return response()->json(['message' => 'removed', 'imageId' => $imageId], 201);
 }