original_string: public function send()
      {
          // We don't want any accidental sending of beacons if the installation has explicitly said no.
          if (!$this->enabled()) {
              return;
          }
  
          $setting = app(Setting::class);
  
          if (!$installId = $setting->get('install_id', null)) {
              $installId = sha1(Str::random(20));
  
              $setting->set('install_id', $installId);
          }
  
          $payload = [
              'install_id' => $installId,
              'version'    => CACHET_VERSION,
              'docker'     => $this->config->get('cachet.is_docker'),
              'database'   => $this->config->get('database.default'),
              'data'       => [
                  'components' => Component::all()->count(),
                  'incidents'  => Incident::all()->count(),
                  'metrics'    => Metric::all()->count(),
                  'users'      => User::all()->count(),
                  'actions'    => Action::all()->count(),
                  'tags'       => Tag::all()->count(),
                  'schedules'  => Schedule::all()->count(),
              ],
          ];
  
          try {
              $client = new Client();
              $client->post(self::URL, [
                  'headers' => ['Accept' => 'application/json', 'User-Agent' => defined('CACHET_VERSION') ? 'cachet/'.constant('CACHET_VERSION') : 'cachet'],
                  'json'    => $payload,
              ]);
          } catch (Exception $e) {
              event(new BeaconFailedToSendEvent());
  
              return;
          }
  
          event(new BeaconWasSentEvent());
      }
code: public function send()
      {
          // We don't want any accidental sending of beacons if the installation has explicitly said no.
          if (!$this->enabled()) {
              return;
          }
  
          $setting = app(Setting::class);
  
          if (!$installId = $setting->get('install_id', null)) {
              $installId = sha1(Str::random(20));
  
              $setting->set('install_id', $installId);
          }
  
          $payload = [
              'install_id' => $installId,
              'version'    => CACHET_VERSION,
              'docker'     => $this->config->get('cachet.is_docker'),
              'database'   => $this->config->get('database.default'),
              'data'       => [
                  'components' => Component::all()->count(),
                  'incidents'  => Incident::all()->count(),
                  'metrics'    => Metric::all()->count(),
                  'users'      => User::all()->count(),
                  'actions'    => Action::all()->count(),
                  'tags'       => Tag::all()->count(),
                  'schedules'  => Schedule::all()->count(),
              ],
          ];
  
          try {
              $client = new Client();
              $client->post(self::URL, [
                  'headers' => ['Accept' => 'application/json', 'User-Agent' => defined('CACHET_VERSION') ? 'cachet/'.constant('CACHET_VERSION') : 'cachet'],
                  'json'    => $payload,
              ]);
          } catch (Exception $e) {
              event(new BeaconFailedToSendEvent());
  
              return;
          }
  
          event(new BeaconWasSentEvent());
      }
code_tokens: public function send ( ) { // We don't want any accidental sending of beacons if the installation has explicitly said no. if ( ! $ this -> enabled ( ) ) { return ; } $ setting = app ( Setting :: class ) ; if ( ! $ installId = $ setting -> get ( 'install_id' , null ) ) { $ installId = sha1 ( Str :: random ( 20 ) ) ; $ setting -> set ( 'install_id' , $ installId ) ; } $ payload = [ 'install_id' => $ installId , 'version' => CACHET_VERSION , 'docker' => $ this -> config -> get ( 'cachet.is_docker' ) , 'database' => $ this -> config -> get ( 'database.default' ) , 'data' => [ 'components' => Component :: all ( ) -> count ( ) , 'incidents' => Incident :: all ( ) -> count ( ) , 'metrics' => Metric :: all ( ) -> count ( ) , 'users' => User :: all ( ) -> count ( ) , 'actions' => Action :: all ( ) -> count ( ) , 'tags' => Tag :: all ( ) -> count ( ) , 'schedules' => Schedule :: all ( ) -> count ( ) , ] , ] ; try { $ client = new Client ( ) ; $ client -> post ( self :: URL , [ 'headers' => [ 'Accept' => 'application/json' , 'User-Agent' => defined ( 'CACHET_VERSION' ) ? 'cachet/' . constant ( 'CACHET_VERSION' ) : 'cachet' ] , 'json' => $ payload , ] ) ; } catch ( Exception $ e ) { event ( new BeaconFailedToSendEvent ( ) ) ; return ; } event ( new BeaconWasSentEvent ( ) ) ; }
docstring: Send a beacon to our server.
  
  @return void
docstring_tokens: Send a beacon to our server .