我的日历控制器中有一个拒绝功能,但是每当我重定向到视图页面时,它都会显示一个错误,说明我的路线未定义。
我已经尝试重新排列和重命名我的路线,但它仍然显示错误。
这是我的表格:
{!! Form::open(['url' => route('therapist.reject.appointment', $bookingRequest), 'method' => 'delete', 'onsubmit' => 'javascript:return confirm("Are you sure?")']) !!}
<button type="submit" class="btn btn-warning btn-block">Reject this appointment</button>
{{csrf_field()}}
{!! Form::close() !!}
这是我的路线。显示的其他路线运行良好:
Route::get('therapist-calendar/{bookingRequest}', 'TherapistCalander')->name('therapist.calendar');
Route::post('therapist-calendar/{bookingRequest}',
'TherapistCalander@saveAppointment')->name('therapist.book.appointment');
Route::patch('therapist-calendar/{bookingRequest}',
'TherapistCalander@finishedAppointment')->name('therapist.finish.appointment');
Route::delete('therapist-calendar/{bookingRequest}',
'TherapistCalander@rejectAppointment')->name('therapist.reject.appointment');
Route::delete('therapist-calendar/{bookingRequest}',
'TherapistCalander@cancelAppointment')->name('therapist.cancel.appointment');
最后,我的功能:
public function rejectAppointment(Request $request, BookingRequest $bookingRequest)
{
$bookingRequest->reject();
return redirect()->back()->with('rejectStatus', true);
}
该按钮所属的视图页面应该能够在日历视图旁边显示拒绝和完成按钮。
编辑 后续问题:可能是因为路线彼此相似吗?如果是这样,我该如何解决这个问题?