code: public function encrypt($data, string $key = null): string
      {
          $key = $this->createKey($key);
          $data = Crypto::encrypt(serialize($data), $key);
  
          return $data;
      }
docs: Encrypt data using secret key
  
  @param mixed $data
  @param string $key
  @return string