Laravel - Working With Database

Laravel has made handling with database simple. Laravel presently bolsters following 4 databases −

  • MySQL
  • Postgres
  • SQLite
  • SQL Server

Connecting to Database

Configure the database in config/database.php record and make the school database with structure in MySQL as appeared in the accompanying table.

Database: College

Table: student

Column Name Column Datatype Extra
Id int(11) Primary key | Auto increment
Name varchar(25)

We will perceive how to include, erase, refresh and recover records from database utilizing Laravel in understudy table.

Sr.No. Records & Description
1 Insert Records

We can embed the record utilizing the DB exterior with supplement method.

2 Retrieve Records

After arranging the database, we can recover the records utilizing the DB veneer with select method.

3 Update Records

We can refresh the records utilizing the DB exterior with refresh method.

4 Delete Records

We can erase the record utilizing the DB exterior with the erase method.