I'm trying to create a custom function for a Controller class that I'm using as ResourceController. I'm doing it cause I only want to update 1 field, but I want to keep the existing update function for other things.
I've tried to put it before the resource in the api.php as people said but still no good.
Route::put('/post/reorder/{id}', 'PostController@reorder');
Route::resource('/post', PostController::class);
This is the code in the controller
public function reorder(Request $request, $id){
$post = Post::findOrfail($id);
...
Also, when running php artisan route:list it shows this error.
Illuminate\Contracts\Container\BindingResolutionException
Target class [PostController] does not exist.
This is the code in VUE that's calling it
export const API_URL = "http://localhost:8000/api/post";
axios
.put(API_URL + `/reorder/${item.id}`, {
// title: item.title,
// path: item.path,
// description: item.description,
order: newIndex,
})
And when I run it, it gives the Internal Server Error 500
It works when I'm using the default function that resource gave me, I just don't want to have to input the fields I don't want to change.
So what did I do wrong?