英文:
When you give a 404 NOT FOUND , even though I am using it route resource . I don't go to any page
问题
当您返回`404 NOT FOUND`时,即使我使用了路由资源,也不会跳转到任何页面。
```php
Route::resource('/', ClientController::class)
<tbody>
@forelse($clients as $client)
<tr>
<th scope="row">{{$client->id}}</th>
<td>{{$client->email}}</td>
<td>{{$client->password}}</td>
<td>{{$client->city}}</td>
<td><a href="{{route('edit',$client->id)}}" >Update</a></td>
</tr>
<tr>
@empty
<h1>pas de client</h1>
@endforelse
</tbody>
public function edit($id)
{
return $id;
}
英文:
When you give a 404 NOT FOUND
, even though I am using it route resource. I don't go to any page
Route::resource('/' , ClientController::class)
<tbody>
@forelse($clients as $client)
<tr>
<th scope="row">{{$client->id}}</th>
<td>{{$client->email}}</td>
<td>{{$client->password}}</td>
<td>{{$client->city}}</td>
<td><a href="{{route('edit',$client->id)}}" >Update</a></td>
</tr>
<tr>
@empty
<h1>pas de client</h1>
@endforelse
</tbody>
public function edit($id)
{
return $id;
}
答案1
得分: 1
以下是翻译好的部分:
public function edit($id)
{
return redirect()->back();
}
或者:
public function edit($id)
{
return redirect()->route('route.name');
}
英文:
Your return needs to go somewhere, try:
public function edit($id)
{
return redirect()->back();
}
or:
public function edit($id)
{
return redirect()->route('route.name');
}
答案2
得分: 0
Route::resource('/client', ClientController::class);
<td><a href="{{route('client.edit', $client->id)}}">Update</a></td>
英文:
Route::resource('/' , ClientController::class);
Change the above to:
Route::resource('/client' , ClientController::class);
Then, in the blade for edit:
<td><a href="{{route('client.edit',$client->id)}}" >Update</a></td>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论