user(); $allUserCredentials = $user->webAuthnCredentials() ->enabled() ->get() ->all(); return response()->json($allUserCredentials, 200); } /** * Rename a WebAuthn device * * @param \App\Http\Requests\WebauthnRenameRequest $request * @return \Illuminate\Http\JsonResponse */ public function rename(WebauthnRenameRequest $request, string $credential) { $validated = $request->validated(); $webAuthnCredential = WebAuthnCredential::where('id', $credential)->firstOrFail(); $webAuthnCredential->name = $validated['name']; $webAuthnCredential->save(); return response()->json([ 'name' => $webAuthnCredential->name, ], 200); } /** * Remove the specified credential from storage. * * @return \Illuminate\Http\JsonResponse */ public function delete(Request $request, $credential) { $user = $request->user(); $user->removeCredential($credential); return response()->json(null, 204); } }