-1
@foreach($products as $product)
    <tr>
        <td>{{ $product->id }}</td>
        <td>{{ $product->name }}</td>
        <td>{{ $product->job_category }}</td>
        <td>{{ $product->purpose }}</td>
        <td>{{ $product->region }}</td>
        <td>{{ $product->email }}</td>
        <td>{{ $product->contact }}</td>
        <td><a href="{{ route('$products.edit', $product->id) }}" class="btn btn-primary">Edit</a></td>
        <td>
            <form action="{{ route('$products.destroy', $product->id) }}" method="post">
                @csrf
                @method('DELETE')
                    <button class="btn btn-danger" type="submit">DELETE</button>
            </form>
        </td>
    </tr>
@endforeach

This is my ProductController

$product = Product::findOrFail($id);

return view('products.edit', compact('product'));

And this is my route

Route::resource('products', 'ProductController');
derloopkat
  • 6,232
  • 16
  • 38
  • 45
John Kyei
  • 9
  • 2

1 Answers1

1

Just remove $ from route name here

href="{{ route('$products.edit', $product->id) }}"

//and here :

action="{{ route('$products.destroy', $product->id) }}"

should be

href="{{ route('products.edit', $product->id) }}"
action="{{ route('products.destroy', $product->id) }}"