database.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. return array(
  3. /*
  4. |--------------------------------------------------------------------------
  5. | Default Database Connection
  6. |--------------------------------------------------------------------------
  7. |
  8. | The name of your default database connection.
  9. |
  10. | This connection will be the default for all database operations unless a
  11. | different connection is specified when performing the operation. The name
  12. | of the default connection should correspond to the name of a connector
  13. | defined below.
  14. |
  15. */
  16. 'default' => 'sqlite',
  17. /*
  18. |--------------------------------------------------------------------------
  19. | Database Connectors
  20. |--------------------------------------------------------------------------
  21. |
  22. | All of the database connectors used by your application.
  23. |
  24. | Each connector should return a PDO connection. You may connect to any
  25. | database system you wish. Of course, default configurations for the
  26. | systems supported by Laravel are provided for you.
  27. |
  28. | The entire database configuration array is passed to the connector
  29. | closure, so you may convenient use it when connecting to your database.
  30. |
  31. | Note: When using an unsupported database, Eloquent and the fluent query
  32. | builder may not work as expected. Currently, MySQL, Postgres, and
  33. | SQLite are fully supported by Laravel.
  34. |
  35. */
  36. 'connectors' => array(
  37. 'sqlite' => function($config)
  38. {
  39. return new PDO('sqlite:'.DATABASE_PATH.'application.sqlite', null, null, $config['options']);
  40. }
  41. 'mysql' => function($config)
  42. {
  43. return new PDO('mysql:host=localhost;dbname=database', 'username', 'password', $config['options']);
  44. }
  45. 'pgsql' => array(
  46. return new PDO('pgsql:host=localhost;dbname=database', 'username', 'password', $config['options']);
  47. ),
  48. ),
  49. /*
  50. |--------------------------------------------------------------------------
  51. | Database PDO Options
  52. |--------------------------------------------------------------------------
  53. |
  54. | Here you may specify the PDO options that should be used when connecting
  55. | to a database. The entire database configuration array is passed to the
  56. | database connector closures, so may convenient access these options from
  57. | your connectors.
  58. |
  59. | For a list of options, visit: http://php.net/manual/en/pdo.setattribute.php
  60. |
  61. */
  62. 'options' => array(
  63. PDO::ATTR_CASE => PDO::CASE_LOWER,
  64. PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
  65. PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL,
  66. PDO::ATTR_STRINGIFY_FETCHES => false,
  67. PDO::ATTR_EMULATE_PREPARES => false,
  68. ),
  69. );