diff --git a/app/Http/Controllers/AccountApiController.php b/app/Http/Controllers/AccountApiController.php index ffbc17568a..57b8fd17b6 100644 --- a/app/Http/Controllers/AccountApiController.php +++ b/app/Http/Controllers/AccountApiController.php @@ -163,24 +163,25 @@ class AccountApiController extends BaseAPIController $devices = json_decode($account->devices, TRUE); if(count($devices)<1) - return $this->errorResponse(['message'=>'no devices exist'], 400); + return $this->errorResponse(['message'=>'No registered devices.'], 400); for($x=0; $xusername) { - unset($devices[$x]); $newDevice = [ - 'token' => $request->token, - 'email' => $request->email, - 'device' => $request->device, + 'token' => $devices[$x]['token'], + 'email' => $devices[$x]['email'], + 'device' => $devices[$x]['device'], 'notify_sent' => $request->notify_sent, 'notify_viewed' => $request->notify_viewed, 'notify_approved' => $request->notify_approved, 'notify_paid' => $request->notify_paid, ]; + unset($devices[$x]); + $devices[] = $newDevice; $account->devices = json_encode($devices); $account->save(); diff --git a/composer.lock b/composer.lock index 61af58eb88..eaa49a5418 100644 --- a/composer.lock +++ b/composer.lock @@ -123,12 +123,12 @@ "source": { "type": "git", "url": "https://github.com/formers/former.git", - "reference": "795f7b9b200a4ff4a33b37a96eaaab0229e36325" + "reference": "e196c4336db77be97131f6a3b3c3b69b3a22b683" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/formers/former/zipball/795f7b9b200a4ff4a33b37a96eaaab0229e36325", - "reference": "795f7b9b200a4ff4a33b37a96eaaab0229e36325", + "url": "https://api.github.com/repos/formers/former/zipball/e196c4336db77be97131f6a3b3c3b69b3a22b683", + "reference": "e196c4336db77be97131f6a3b3c3b69b3a22b683", "shasum": "" }, "require": { @@ -174,7 +174,7 @@ "foundation", "laravel" ], - "time": "2015-11-05 15:53:52" + "time": "2016-03-02 17:21:21" }, { "name": "anahkiasen/html-object",