Routing
Laravel 8
Laravel 9
Laravel 10
Laravel 11
Laravel 12
405 Method Not Allowed in Laravel - Route Fix
This error occurs when you try to access a route with an HTTP method that the route doesn't support.
The Error
Error Message
405 Method Not Allowed
Common Causes
- 1 Submitting form with wrong method
- 2 Route defined as GET but accessed via POST
- 3 Missing method spoofing for PUT/PATCH/DELETE
- 4 AJAX request using wrong HTTP verb
Solutions
1
Match form method to route definition
PHP
// Route
Route::post('/posts', [PostController::class, 'store']);
// Form
<form method="POST" action="/posts">
2
Use method spoofing for PUT/PATCH/DELETE
Blade
<form method="POST" action="/posts/1">
@csrf
@method('PUT')
<!-- or -->
<input type="hidden" name="_method" value="PUT">
</form>
3
Check your routes
Bash
php artisan route:list
Need Help With Your Laravel Project?
I specialize in building custom Laravel applications, process automation, and SaaS development. Whether you need to eliminate repetitive tasks or build something from scratch, let's discuss your project.
About Hafiz
Senior Full Stack Developer. I build production software with Laravel, Filament, Vue, and AI integrations, and write about the real decisions behind shipping it.
Get in touch →