Beispiel #1
0
 public function getConnect()
 {
     if ($this->_connect === null) {
         $this->_connect = \Connect\Connect::initialize($this->projectId, $this->pushApiKey);
     }
     return $this->_connect;
 }
 /**
  * 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();
 }