code: public function validate_unique($value, $input, $args)
      {
          $table  = $args[0];
          $column = $args[1];
          $value  = trim($value);
  
          $exists = $this->db->prepare("
              SELECT count(*) as count
              FROM {$table}
              WHERE {$column} = :value
          ");
  
          $exists->execute([
              'value' => $value
          ]);
  
          return ! (bool) $exists->fetchObject()->count;
      }
docs: Check if a value already exists in a database table.
  
  @param  mixed $value
  @param  array $input
  @param  array $args
  
  @return bool