路线 [foo/1/bar] 未定义
Route [foo/1/bar] not defined
路线 [foo/1/bar] 未定义。在 resources/views/bar/create.blade.php
中找到
这是在routes/web.php;
Route::post('/foo/{client}/bar', 'BarController@store');
这是导致问题的行;
form action="{{ route('foo/'.$client->id.'/bar') }}" method="POST" enctype="multipart/form-data">
想通了!
我变了
Route::post('/foo/{client}/bar', 'BarController@store');
到
Route::post('/foo/{client}/bar', 'BarController@store')->name('bar_post');
还有这个
form action="{{ route('foo/'.$client->id.'/bar') }}" method="POST" enctype="multipart/form-data">
对此
form action="{{ route('bar_post', ['client', $client->id]) }}" method="POST" enctype="multipart/form-data">
应该做的是
form action="{{ url('foo/'.$client->id.'/bar') }}" method="POST" enctype="multipart/form-data">
因为你没有像这样定义名称路由
Route::post('/foo/{client}/bar', 'BarController@store')->name('bar_post');
路线 [foo/1/bar] 未定义。在 resources/views/bar/create.blade.php
中找到这是在routes/web.php;
Route::post('/foo/{client}/bar', 'BarController@store');
这是导致问题的行;
form action="{{ route('foo/'.$client->id.'/bar') }}" method="POST" enctype="multipart/form-data">
想通了!
我变了
Route::post('/foo/{client}/bar', 'BarController@store');
到
Route::post('/foo/{client}/bar', 'BarController@store')->name('bar_post');
还有这个
form action="{{ route('foo/'.$client->id.'/bar') }}" method="POST" enctype="multipart/form-data">
对此
form action="{{ route('bar_post', ['client', $client->id]) }}" method="POST" enctype="multipart/form-data">
应该做的是
form action="{{ url('foo/'.$client->id.'/bar') }}" method="POST" enctype="multipart/form-data">
因为你没有像这样定义名称路由
Route::post('/foo/{client}/bar', 'BarController@store')->name('bar_post');