I have Excel Import project using Maatwebsite package in Laravel-5.8. I have been able to perform the Excel import and save it into the database successfully.
UserController
class UserssController extends Controller
{
public function importExportView()
{
return view('import');
}
public function import()
{
Excel::import(new UsersImport,request()->file('file'));
return back();
}
}
user.blade
<div class="container">
<div class="card bg-light mt-3">
<div class="card-header">
Import Excel
</div>
<div class="card-body">
<form action="{{ route('import') }}" method="POST" enctype="multipart/form-data">
@csrf
<input type="file" name="file" class="form-control">
<br>
<button class="btn btn-success">Import User Data</button>
</form>
</div>
</div>
However, there is one more thing. I have a sample Excel file. Before import, I want the user to download the sample excel sheet and see how the file format is, and how it should be arranged.
The file is in this directory: public/storage/sample/user.xlsx
How do I modify my code, especially in the view to achieve this?
Thank you.