original_string: protected function setDatabaseVersion($code, $version = null)
      {
          $currentVersion = $this->getDatabaseVersion($code);
  
          if ($version && !$currentVersion) {
              Db::table('system_plugin_versions')->insert([
                  'code' => $code,
                  'version' => $version,
                  'created_at' => new Carbon
              ]);
          }
          elseif ($version && $currentVersion) {
              Db::table('system_plugin_versions')->where('code', $code)->update([
                  'version' => $version,
                  'created_at' => new Carbon
              ]);
          }
          elseif ($currentVersion) {
              Db::table('system_plugin_versions')->where('code', $code)->delete();
          }
  
          $this->databaseVersions[$code] = $version;
      }
code: protected function setDatabaseVersion($code, $version = null)
      {
          $currentVersion = $this->getDatabaseVersion($code);
  
          if ($version && !$currentVersion) {
              Db::table('system_plugin_versions')->insert([
                  'code' => $code,
                  'version' => $version,
                  'created_at' => new Carbon
              ]);
          }
          elseif ($version && $currentVersion) {
              Db::table('system_plugin_versions')->where('code', $code)->update([
                  'version' => $version,
                  'created_at' => new Carbon
              ]);
          }
          elseif ($currentVersion) {
              Db::table('system_plugin_versions')->where('code', $code)->delete();
          }
  
          $this->databaseVersions[$code] = $version;
      }
code_tokens: protected function setDatabaseVersion ( $ code , $ version = null ) { $ currentVersion = $ this -> getDatabaseVersion ( $ code ) ; if ( $ version && ! $ currentVersion ) { Db :: table ( 'system_plugin_versions' ) -> insert ( [ 'code' => $ code , 'version' => $ version , 'created_at' => new Carbon ] ) ; } elseif ( $ version && $ currentVersion ) { Db :: table ( 'system_plugin_versions' ) -> where ( 'code' , $ code ) -> update ( [ 'version' => $ version , 'created_at' => new Carbon ] ) ; } elseif ( $ currentVersion ) { Db :: table ( 'system_plugin_versions' ) -> where ( 'code' , $ code ) -> delete ( ) ; } $ this -> databaseVersions [ $ code ] = $ version ; }
docstring: Updates a plugin version in the database.
docstring_tokens: Updates a plugin version in the database .