Step 1: Install Laravel 7 Project
Run this command to create a new Laravel project:
Step 2: Install Maatwebsite Excel Package
Install the Maatwebsite Excel package using Composer:
Next, open the config/app.php
file and add the service provider and alias:
Publish the configuration file:
This creates the configuration file config/excel.php
.
Step 3: Define Routes
In routes/web.php
, add routes for importing, inserting, updating, and deleting records:
Step 4: Migration for Import Data
Create a migration for the import_excels
table:
Run the migration:
Step 5: Create the Blade View for Excel Import (import_excel.blade.php
)
Step 6: Create the Excel Import Class
Generate an export class:
In app/Imports/ExcelImport.php
:
Step 7: Create the Controller (ImportExcelController.php
)
In app/Http/Controllers/ImportExcelController.php
:
Step 8: Finalizing the Frontend
Add modals for adding and updating records. Also, implement a table to display the imported data, with options for editing and deleting records.