/**
  * Handle the server was poked event.
  *
  * @param ServerWasPoked $event
  *
  * @return void
  */
 public function handle(ServerWasPoked $event)
 {
     $channel = env('PUSHER_CHANNEL', 'pi-finder');
     $device = $event->getDevice();
     if ($device->isPublic()) {
         $this->pusher->trigger($channel, 'ServerWasPoked', ['device' => $this->transformer->transform($device)]);
     } else {
         $channel = $channel . '-' . $device->group;
         $this->pusher->trigger($channel, 'ServerWasPoked', ['device' => $this->transformer->transform($device)]);
     }
 }
Example #2
0
 /**
  * Handle the event.
  *
  * @param ServerWasPoked $event
  *
  * @return void
  */
 public function handle(ServerWasPoked $event)
 {
     Poke::create($event->getDevice()->toArray());
 }