Beispiel #1
0
 public function getConnect()
 {
     if ($this->_connect === null) {
         $this->_connect = \Connect\Connect::initialize($this->projectId, $this->pushApiKey);
     }
     return $this->_connect;
 }
 public function testEncryptedFilteredKeyDecryptToTheSameValue()
 {
     $masterKey = '00000000000000000000000000000000';
     $keyDefinition = ['filters' => ['type' => 'cycling'], "canQuery" => True, "canPush" => True];
     $originalValue = json_encode($keyDefinition);
     $filtered_key = Connect::generateFilteredKey($keyDefinition, $masterKey);
     $decrypted = Security::decryptFilteredKey($filtered_key, $masterKey);
     assert($originalValue === $decrypted);
 }
 public function testThatPushingBeforeInitializationThrowsAnExceptionWithMessage()
 {
     $purchase = ['customer' => ['firstName' => 'Tom', 'lastName' => 'Smith'], 'product' => '12 red roses', 'purchasePrice' => 34.95];
     try {
         Connect::push('purchases', $purchase);
         $this->fail('Pushing before initializing should throw an exception');
     } catch (ConfigurationException $exception) {
         $this->assertNotNull($exception->getMessage());
     }
 }
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $users = User::all();
     Connect::initialize('', '');
     $mp = Mixpanel::getInstance(env('MIXPANEL_PROJECT_TOKEN'));
     foreach ($users as $user) {
         $payload = ['user' => $user];
         Connect::push('users', $payload);
         $user->pushToIndex();
     }
 }
 /**
  * Handle the event.
  *
  * @param  UserRegistered  $event
  * @return void
  */
 public function handle(UserRegistered $event)
 {
     $client = ClientBuilder::create()->build();
     $payload = ['user' => $event->user];
     Connect::initialize('', '');
     $mp = Mixpanel::getInstance(env('MIXPANEL_PROJECT_TOKEN'));
     $mp->people->set($event->user->id, $payload);
     $mp->track($event);
     Connect::push('users', $payload);
     $params = ['index' => 'main', 'type' => 'user', 'id' => $event->user->id, 'body' => $event->user];
     $client->index($params);
     //        $event->user->pushToIndex();
 }