I have an a tag within a form that passes multiple optional parameters to the route. But when I skip one parameter in the middle and pass one after that it gives page not found.
How can I overcome this issue without using a form.
Here is my a tag:
<a href="{{ route('admin.employee.employeeListExcelExport', ['start_date' => $start_date, 'end_date' => $end_date, 'empId' => $empId, 'name' => $name] ) }}" class="btn btn-primary">Download</a>
My route:
Route::group(['prefix'=>'/employee','as'=>'employee.'], function(){
Route::get('/', [EmployeeController::class, 'index'])->name('index');
Route::get('/employee-list/excel-export/{start_date?}/{end_date?}/{empId?}/{name?}', [EmployeeController::class, 'employeeListExcelExport'])->name('employeeListExcelExport');
});
The reason I can't use form is because this tag is inside a form and it's not idea to use nested forms.