Beispiel #1
0
 public static function boot()
 {
     parent::boot();
     static::created(function (Service $service) {
         if (!empty($service->config)) {
             // take the type information and get the config_handler class
             // set the config giving the service id and new config
             $serviceCfg = $service->getConfigHandler();
             if (!empty($serviceCfg)) {
                 return $serviceCfg::setConfig($service->getKey(), $service->config);
             }
         }
         return true;
     });
     static::saved(function (Service $service) {
         \Cache::forget('service:' . $service->name);
         \Cache::forget('service_id:' . $service->id);
         // Any changes to services needs to produce a new event list
         Event::clearCache();
         Swagger::clearCache($service->name);
     });
     static::deleting(function (Service $service) {
         // take the type information and get the config_handler class
         // set the config giving the service id and new config
         $serviceCfg = $service->getConfigHandler();
         if (!empty($serviceCfg)) {
             return $serviceCfg::removeConfig($service->getKey());
         }
         return true;
     });
     static::deleted(function (Service $service) {
         \Cache::forget('service:' . $service->name);
         \Cache::forget('service_id:' . $service->id);
         // Any changes to services needs to produce a new event list
         Event::clearCache();
         Swagger::clearCache($service->name);
     });
 }
 /**
  * Refreshes all schema associated with this db connection:
  *
  * @return array
  */
 public function refreshCachedTables()
 {
     $this->parent->refreshTableCache();
     // Any changes to tables needs to produce a new event list
     Event::clearCache();
     Swagger::clearCache($this->getServiceName());
 }