In the newer versions of laravel, the syntax has changed, and it should be array: first the class and the second element the function, ex:
Route::middleware('auth:sanctum')->post( '/logout', [LoginController::class, 'logoutApi'] );