You will learn that how to open a file, read a file, write to a file, close a file, delete a file and lastly read a file line by line by clicking above url which will help you more. So you must know about file handling in PHP.

To import csv file data in database, you must have a Laravel Eloquent Model which belons to database table.

First create a products table in database and then create a model file for product table in following path app/Product.php and put following line of code.

Now you will see how to read csv file using predefined csv reader and how to import its data in database. You can also print the data while importing csv data to database by using print_r command.

Add following line of code in your routes.php, you can put functionality in your route or you can create a function within a controller to read csv file and also importing csv file data to database its upto you.