Routes 抛出新的InvalidArgumentException(“未定义路由[{$name}”);laravell 5.6中的路由错误

Routes 抛出新的InvalidArgumentException(“未定义路由[{$name}”);laravell 5.6中的路由错误,routes,laravel-5.6,Routes,Laravel 5.6,我想更新我的数据库并尝试将其重定向到Laravel 5.6中定义的url public function update(Request $request, Apply1 $Apply1) { $Apply1 ->Given_Name=$request->Given_Name; $Apply1 ->Surname=$request->Surname; $Apply1 ->Date_Birth=$request

我想更新我的数据库并尝试将其重定向到Laravel 5.6中定义的url

 public function update(Request $request, Apply1 $Apply1)
    {

    $Apply1 ->Given_Name=$request->Given_Name;
          $Apply1 ->Surname=$request->Surname;
          $Apply1 ->Date_Birth=$request->Date_Birth;
          $Apply1 ->Place_Birth=$request->Place_Birth;
          $Apply1 ->Mother_Name=$request->Mother_Name;
          $Apply1 ->Father_Name=$request->Father_Name;
          $Apply1 ->Passport_Number=$request->Passport_Number;
          $Apply1 ->Passport_Issue_Date=$request->Passport_Issue_Date;
          $Apply1 ->Passport_Expiry_Date=$request->Passport_Expiry_Date;
          $Apply1 ->Type_Supporting_Doc=$request->Supporting_Doc;
          $Apply1 ->Supporting_Doc_Form=$request->city;
          $Apply1 ->Supp_Doc_Expiry_Date=$request->Supp_Expiry_Date;
          $Apply1 ->E_mail_address=$request->mail_address;
          $Apply1 ->Phone_Number=$request->Phone_Number; 
          $Apply1 ->Address=$request->Address;
          $Apply1 ->City=$request->Permanent_City;
          $Apply1 ->State=$request->Address;
          $Apply1 ->Postal_Code=$request->Permanent_City;
          $Apply1 ->save();   

         return redirect(Route('Apply1.show1', $Apply1->id));         

  }
我定义的路由在web.php文件中

Route::get('Apply1/show1/{id}', function ($id) {
   return 'User '.$id;
});
但最终还是出现了错误(“Route[{$name}]未定义”);
我已经定义了正确的路线,但我不知道为什么会再次出现此错误

我猜您没有正确地遵循路线

您的路线:

Route::get('Apply1/show1/{id}', function ($id) {
   return 'User '.$id;
});
根据文档,您需要在路线末尾添加
name
。也就是说,你应该这样添加它

Route::get('Apply1/show1/{id}', function ($id) {
   return 'User '.$id;
})->name('Apply1.show1'); // you had not written this
这样,你就会得到你想要的结果