Connecting a database to Laravel
The Valley of Code
Your Web Development Manual
We’re using Laravel in a very basic form, without any database.
Now I want to set up a database and configure Laravel to use it.
After we’ve configured the database, I’ll show you how to use forms to accept user input and store data in the database, and how to visualize this data.
I’ll also show you how you can use data from the database with dynamic routes.
Connect the database to Laravel
The easiest way to use a database is by using SQLite.
SQLite is just a file hosted in your site, no special setup needed.
.env file, and instead of the default configuration
Laravel will automatically create a SQLite database in
database/database.sqlite the first time you run a migration.