You are not passing the category ID when trying to update the resource, look carefully:
Request URL: http://me.massiels/category
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
This has happened to me on another project and I just gave up and made everything a post. I want to find out why this is happening. I'm using Vue and Inertia.js. In this case I'm trying to update but the same happens for the delete route. I'm using Laravel 8 in case that is relevant.
The bizarre thing is I get the error but after reloading the item have been successfully edited or deleted, I don't understand the error if it's just gonna do it anyway.
This is my code for the update and delete inertia requests
baseUrl: '/category';
//update
this.$inertia.put(this.baseUrl + '/' + this.form.id, this.form);
//delete
this.$inertia.delete(this.baseUrl + '/' + $id);
the routes
Route::resource('category', 'CategoryController')->except(['create', 'edit']);
the methods in my controller
public function update(Request $request, $id)
{
$request->validate([
'name' => 'required|max:255|unique:categories,name,' . $id,
'description' => 'required|max:255',
]);
$category = Category::findOrFail($id);
$category->name = $request->name;
$category->description = $request->description;
$category->save();
DB::commit();
return back();
}
public function destroy($id)
{
DB::beginTransaction();
$category = Category::findOrFail($id);
$category->delete();
DB::commit();
return redirect('/category');
}
I have both a redirect and just a return back to see if that was causing the issue but it's not.
Also in the networking tab on my browser I can see it has made 2 requests one is to the correct url
Request URL:http://me.massiels/category/3
Request Method: PUT
Status Code: 302 Found
and another one that is the one giving me an error
Request URL: http://me.massiels/category
Request Method: PUT
Status Code: 405 Method Not Allowed
I ran route:cache, route:clear, composer dumpautoload, and route:list the list appears like this
GET|HEAD|category|category.index|CategoryController@index|web|auth|role:admin
POST|category|category.store|CategoryController@store|web|auth|role:admin
DELETE|category/{category}|category.destroy|CategoryController@destroy|web |auth|role:admin
PUT|PATCH|category/{category}|category.update|CategoryController@update|web|auth|role:admin
GET|HEAD|category/{category}|category.show|CategoryController@show |web|auth|role:admin
What am I doing wrong, how can I fix this?
See @Juhlinus answer here, I am almost sure you need a spoof.
https://github.com/inertiajs/pingcrm/issues/69
Not laravel there, but put is discussed.
Depending on your version there was also an issue:
Please or to participate in this conversation.