예제 #1
0
 /**
  * {@inheritdoc}
  */
 public function setAttribute($key, $value)
 {
     if ($key === 'value' && $value === self::PRIVATE_MASK && $this->exists) {
         $value = $this->value;
     }
     parent::setAttribute($key, $value);
 }
예제 #2
0
파일: Config.php 프로젝트: df-arif/df-core
 public static function boot()
 {
     parent::boot();
     static::saved(function (Config $config) {
         if (Cache::has('system_config')) {
             Cache::forget('system_config');
         }
     });
 }
예제 #3
0
 /**
  * {@inheritdoc}
  */
 public static function boot()
 {
     parent::boot();
     static::creating(function (CorsConfig $config) {
         $config->validateAndClean();
         return true;
     });
     static::updating(function (CorsConfig $config) {
         $config->validateAndClean();
         return true;
     });
 }
예제 #4
0
파일: Role.php 프로젝트: df-arif/df-core
 public static function boot()
 {
     parent::boot();
     static::saved(function (Role $role) {
         if (!$role->is_active) {
             JWTUtilities::invalidateTokenByRoleId($role->id);
         }
         \Cache::forget('role:' . $role->id);
     });
     static::deleted(function (Role $role) {
         JWTUtilities::invalidateTokenByRoleId($role->id);
         \Cache::forget('role:' . $role->id);
     });
 }
예제 #5
0
 public static function boot()
 {
     parent::boot();
     static::saving(function (RoleServiceAccess $rsa) {
         if (1 === $rsa->service_id && ('*' === $rsa->component || 'admin' === $rsa->component)) {
             throw new BadRequestException('* and/or admin is not allowed on system service.');
         }
     });
     static::saved(function (RoleServiceAccess $rsa) {
         \Cache::forget('role:' . $rsa->role_id);
     });
     static::deleted(function (RoleServiceAccess $rsa) {
         \Cache::forget('role:' . $rsa->role_id);
     });
 }
예제 #6
0
파일: Service.php 프로젝트: df-arif/df-core
 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);
     });
 }
예제 #7
0
파일: User.php 프로젝트: pkdevboxy/df-core
 public static function boot()
 {
     parent::boot();
     static::saved(function (User $user) {
         if (!$user->is_active) {
             JWTUtilities::invalidateTokenByUserId($user->id);
         }
         \Cache::forget('user:'******'user:' . $user->id);
     });
 }