mardi 30 janvier 2024

Missing required parameter for Route laravel error

Blade.php

<tbody>
foreach ($leave as $model)
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td><div class="btn-group btn-group-sm"><a href=""title="Accept" class="btn btn-info"><i class="fas fa-check"></i></a>
<a href="" title="Reject" class="btn btn-danger"><i class="fas fa-times"></i></a></div></td></tr>
@endforeach
</tbody>

controller

public function LeaveReject($employee_id) {
$leaveApprove = employees_leaves::find($employee_id);
dd($leaveApprove);
$leaveApprove->is_approved = 1;
$leaveApprove->save();
$employeeDetails = EmployeeDetail::where('employee_id', $employee_id)->first();
$employeeDetails->remaining_holiday += 1;
$employeeDetails->save();
session()->flash('error', 'Leave Rejected.');
return redirect()->route('admin.leaveRequests');
}

route

Route::get('/reject/{employee_id}', [App\Http\Controllers\Backend\AdminController::class, 'LeaveReject'])->name('admin.leaveReject');

error - Missing required parameter for [Route: admin.leaveReject] [URI: admin/reject/{employee_id}] [Missing parameter: employee_id].

Hlo guys the above code is regard leave approve and reject.

what i want is on blade.php tag so instead of error need to show employee id and on table i have employee_id but still showing error on view.

if i do here $model->id it's working but i need employee_id instead of the default id.

due to this functionality i can approve and reject leave and manage the leave remaining data.

thanks from advance who will help me.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/KOPUHJM
via IFTTT

Aucun commentaire:

Enregistrer un commentaire