Laravel 缺少[Route:patients.destroy][URI:{language}/patients/{patient}]所需的参数。(参考资料/views/patient/index.blade.php)

Laravel 缺少[Route:patients.destroy][URI:{language}/patients/{patient}]所需的参数。(参考资料/views/patient/index.blade.php),laravel,form-post,Laravel,Form Post,这是我的index.blade.php代码 我用'app()->getLocale()尝试了所有方法,但不幸的是没有得到积极的结果。 我怎样才能修好它 <form action="{{ route('patients.destroy', $patient->id) }}" method="post" style="float: right;"> @csrf @method('DELETE') <button type="submit" style="border: 0;

这是我的index.blade.php代码 我用'app()->getLocale()尝试了所有方法,但不幸的是没有得到积极的结果。 我怎样才能修好它

<form action="{{ route('patients.destroy', $patient->id) }}" method="post" style="float: right;">
@csrf
@method('DELETE')
<button type="submit" style="border: 0; background: none; cursor: pointer;"><i class="fa fa-trash"></i></button>
</form>

您的路由需要两个参数,而您只传递了一个参数,因此请按如下所示更改路由

<form action="{{ route('patients.destroy', ['language'=>'en','id'=>$patient->id]) }}" method="post" style="float: right;">

编辑:-

对于welcome blade,您可以直接访问URL
您的路线需要两个参数,而您只传递了一个参数,因此请按如下所示更改路线

<form action="{{ route('patients.destroy', ['language'=>'en','id'=>$patient->id]) }}" method="post" style="float: right;">

编辑:-

对于welcome blade,您可以直接访问URL


您面临什么错误?你在哪里使用getLocale?你想做什么?您的问题没有提供足够的信息,说明您要发布的路线定义。看起来您有一个语言参数没有传递给route helper函数。我试图访问en/patients,但它给出了缺少[route:patients.destroy][URI:{language}/patients/{patient}所需参数的错误。如果我删除此表单,它允许我访问patientsRoute::redirect(“/”,“/en”);Route::group(['prefix'=>'{language}',function(){Route::get('/',function(){return view('welcome');});Auth::routes();Route::get('/home','HomeController@index')->name('home');Route::resource('patients','PatientController');Route::get('/search','PatientController@search'); });你面临什么样的错误?你在哪里使用getLocale?你想做什么?您的问题没有提供足够的信息,说明您要发布的路线定义。看起来您有一个语言参数没有传递给route helper函数。我试图访问en/patients,但它给出了缺少[route:patients.destroy][URI:{language}/patients/{patient}所需参数的错误。如果我删除此表单,它允许我访问patientsRoute::redirect(“/”,“/en”);Route::group(['prefix'=>'{language}',function(){Route::get('/',function(){return view('welcome');});Auth::routes();Route::get('/home','HomeController@index')->name('home');Route::resource('patients','PatientController');Route::get('/search','PatientController@search'); });我还是有点打扰你:)。。我如何创建一个什么是根/患者?如果它执行href=“{route('home',app()->getLocale())}”错误路径[患者]未定义。/en或/other language/patients我尝试使用该a访问,但我无法处理:)..
href=“{{route('patients.index',app()->getLocale())}”
还有一个问题,我在这里无法处理,我如何在welcome.blade.php中使用href将根目录设置为/en?我如何创建href路由以根据患者各自的id编辑患者,以便找到该路由和用户选择的语言?我仍然有点麻烦你:)。。我如何创建一个什么是根/患者?如果它执行href=“{route('home',app()->getLocale())}”错误路径[患者]未定义。/en或/other language/patients我尝试使用该a访问,但我无法处理:)..
href=“{{route('patients.index',app()->getLocale())}”
还有一个问题,我在这里无法处理,如何将href置于welcome.blade.php中,并将其根目录设置为/en?如何创建href路由以根据患者各自的id编辑患者,以便找到该路由和用户选择的语言?
Route::get('/', function () { 
   return view('welcome'); 
})->name('welcome');
<a href="{{ route('welcome',app()->getLocale ()) }}"></a>