Example #1
0
 public function postUpdate()
 {
     $all = $this->request->all();
     if (isset($all['google_id'])) {
         try {
             $user = User::where('google_id', $all['google_id'])->firstOrFail();
             if ($user->account_id != 0 && $user->account->h5 instanceof Data) {
                 $old_h5 = clone $user->account->h5;
                 $this->dispatch(new UpdateHalo5Account($user->account));
                 $new_h5 = Data::where('account_id', $user->account_id)->first();
                 $msg = MessageGenerator::buildH5UpdateMessage($user->account, $old_h5, $new_h5);
                 return Response::json(['error' => false, 'msg' => $msg], 200);
             } else {
                 return Response::json(['error' => false, 'msg' => 'bitch pls. You need to confirm your gamertag on PandaLove so I know who you are.'], 200);
             }
         } catch (ModelNotFoundException $e) {
             return $this->_error('User account could not be found.');
         }
     }
 }