skip to Main Content

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;
}

2

Answers


  1. Your return needs to go somewhere, try:

    public function edit($id)
    {
        return redirect()->back();
    }
    

    or:

    public function edit($id)
    {
        return redirect()->route('route.name');
    }
    
    Login or Signup to reply.
  2. 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>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search