<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Edit Category</title>
</head>
<body>
    <h1>Edit Category</h1>

    @if($errors->any())
        <div style="color: red;">
            <ul>
                @foreach($errors->all() as $err)
                    <li>{{ $err }}</li>
                @endforeach
            </ul>
        </div>
    @endif

    <form action="{{ route('categories.update', $category->idCategory) }}" method="POST">
        @csrf
        @method('PUT')

        <label for="nameCategory">Category:</label>
        <input type="text" name="nameCategory" id="nameCategory"
               value="{{ old('nameCategory', $category->nameCategory) }}" required>

        <button type="submit">Update</button>
        <a href="{{ route('categories.index') }}">Back</a>
    </form>
</body>
</html>
