mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Push Notifications
This commit is contained in:
parent
1aef96f027
commit
6e3b1ecb4b
@ -125,14 +125,17 @@ class AccountApiController extends BaseAPIController
|
|||||||
//scan if this user has a token already registered (tokens can change, so we need to use the users email as key)
|
//scan if this user has a token already registered (tokens can change, so we need to use the users email as key)
|
||||||
$devices = json_decode($account->devices,TRUE);
|
$devices = json_decode($account->devices,TRUE);
|
||||||
|
|
||||||
if(count($devices) >= 1) {
|
|
||||||
foreach ($devices as $device) {
|
for($x=0; $x<count($devices); $x++)
|
||||||
if ($device['email'] == Auth::user()->username) {
|
{
|
||||||
$device['token'] = $request->token; //update
|
if ($devices[$x]['email'] == Auth::user()->username) {
|
||||||
|
$devices[$x]['token'] = $request->token; //update
|
||||||
|
$account->devices = json_encode($devices);
|
||||||
|
$account->save();
|
||||||
return $this->response($account);
|
return $this->response($account);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
//User does not have a device, create new record
|
//User does not have a device, create new record
|
||||||
|
|
||||||
$newDevice = [
|
$newDevice = [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user