06.10.2016 Views

laravel-5

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Database: Getting Started 513<br />

1 DB_CONNECTION=sqlite<br />

2 DB_DATABASE=/absolute/path/to/database.sqlite<br />

SQL Server Configuration<br />

Laravel supports SQL Server out of the box; however, you will need to add the connection<br />

configuration for the database:<br />

1 'sqlsrv' => [<br />

2 'driver' => 'sqlsrv',<br />

3 'host' => env('DB_HOST', 'localhost'),<br />

4 'database' => env('DB_DATABASE', 'forge'),<br />

5 'username' => env('DB_USERNAME', 'forge'),<br />

6 'password' => env('DB_PASSWORD', ''),<br />

7 'charset' => 'utf8',<br />

8 'prefix' => '',<br />

9 ],<br />

Read / Write Connections<br />

Sometimes you may wish to use one database connection for SELECT statements, and another for<br />

INSERT, UPDATE, and DELETE statements. Laravel makes this a breeze, and the proper connections<br />

will always be used whether you are using raw queries, the query builder, or the Eloquent ORM.<br />

To see how read / write connections should be configured, let’s look at this example:<br />

1 'mysql' => [<br />

2 'read' => [<br />

3 'host' => '192.168.1.1',<br />

4 ],<br />

5 'write' => [<br />

6 'host' => '196.168.1.2'<br />

7 ],<br />

8 'driver' => 'mysql',<br />

9 'database' => 'database',<br />

10 'username' => 'root',<br />

11 'password' => '',<br />

12 'charset' => 'utf8',

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!