ParsesSearchPath.php 578 B

12345678910111213141516171819202122232425
  1. <?php
  2. namespace Illuminate\Database\Concerns;
  3. trait ParsesSearchPath
  4. {
  5. /**
  6. * Parse the Postgres "search_path" configuration value into an array.
  7. *
  8. * @param string|array|null $searchPath
  9. * @return array
  10. */
  11. protected function parseSearchPath($searchPath)
  12. {
  13. if (is_string($searchPath)) {
  14. preg_match_all('/[^\s,"\']+/', $searchPath, $matches);
  15. $searchPath = $matches[0];
  16. }
  17. return array_map(function ($schema) {
  18. return trim($schema, '\'"');
  19. }, $searchPath ?? []);
  20. }
  21. }