BenBermingham
3 months ago
357
6
Laravel

Laravel 5.8 error 404 | Not found on route when it exists

Posted 3 months ago by BenBermingham

I am having a issue with a website that I am working on which is giving a 404 error on a route when it exists and is filling in the correct url to the browser. Web.php file:

Route::post('/training/availability/{$id}/delete', '[email protected]')->name('availability.delete');

Training ControllerController:

public function delete($id)
{
    $available = Availability::find($id);
    $available->delete();

    return redirect('/'); 
}

Code on the button

<a href="{{ route('availability.delete', $avail->id )}}" style="color: white;">Remove</a>

I tried changing the route to ::get but it produces the same error

Please sign in or create an account to participate in this conversation.