You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As you can see it is necessary to create the `.env` file in your local to bootstrap the project. But `Laravel` contains 2 methods to connect to the database server.
27
+
28
+
- Use of the `.env` variables *(I prefer this one)*
29
+
- Use of the file located at the `config/database.php`
30
+
31
+
32
+
33
+
## Use of the `.env` variables:
34
+
35
+
When you create this file with copy paste credentials you can see default the database variables are written something like this:
36
+
```
37
+
DB_CONNECTION=mysql
38
+
DB_HOST=127.0.0.1
39
+
DB_PORT=3306
40
+
DB_DATABASE=test_app
41
+
DB_USERNAME=root
42
+
DB_PASSWORD=
43
+
```
44
+
45
+
You can edit values according to your own database personal preference. I am using Postgres in this case.
46
+
47
+
## Use of the file located at the `config/database.php`
48
+
49
+
**Note:** When Laravel bootstraps the project it gives priority to the `.env` file as compared to `config/**` files. You can see `config/database` file contains an associated array with default database settings like this.
0 commit comments