private function clean()
 {
     foreach ($this->results[static::INVALID] as $token) {
         Device::wherePlatform('android')->whereToken($token)->delete();
     }
     foreach ($this->results[static::UPDATED] as $token => $new_token) {
         $device = Device::wherePlatform('android')->whereToken($token)->first();
         $device->token = $new_token;
         $device->save();
     }
 }
Example #2
0
 function cleanDB()
 {
     if (!empty($this->results[static::INVALID])) {
         Device::wherePlatform('ios')->whereEnvironment(getenv('IOS_PUSH_ENVIRONMENT'))->whereIn('token', $this->results[static::INVALID])->delete();
     }
 }