/**
  * Check if jsonb field has all or any of the keys/elements specified in $keys array
  * @param Builder $query
  * @param string $column
  * @param array $keys
  * @param string $has all|any
  * @return Builder
  */
 public function scopeWherePgJsonbKeysExist(Builder $query, $column, array $keys, $has = 'all')
 {
     $mark = '&';
     if ($has === 'any') {
         $mark = '|';
     }
     $keys = Helper::phpArrayToPostgresArray($keys);
     $column = Helper::nestedJsonColumn($column);
     return $query->whereRaw("{$column} \\?{$mark} ?", [$keys]);
 }
 /**
  * Mutates php array to acceptable format of postgreSQL array field
  * @param array $array
  * @return mixed
  */
 public static function mutateToPgArray(array $array)
 {
     return Helper::phpArrayToPostgresArray($array);
 }