Laravel - Working With Database
Laravel has made processing with database very easy. Laravel currently supports following 4 databases −
- SQL Server
Connecting to Database
Configure the database in config/database.php file and create the college database with structure in MySQL as shown in the following table.
|Column Name||Column Datatype||Extra|
|Id||int(11)||Primary key | Auto increment|
We will see how to add, delete, update and retrieve records from database using Laravel in student table.
|Sr.No.||Records & Description|
We can insert the record using the DB facade with insert method.
After configuring the database, we can retrieve the records using the DB facade with select method.
We can update the records using the DB facade with update method.
We can delete the record using the DB facade with the delete method.