<div class="form-group">
    <label for="category_id">{{ __('Category') }}</label>
    <select name="category_id" id="category_id" class="form-control @error('category_id') is-invalid @enderror">
        <option value="">{{ __('Select Category (Optional)') }}</option>
        @foreach($categories as $category)
            <option value="{{ $category->id }}" {{ old('category_id') == $category->id ? 'selected' : '' }}>
                {{ $category->name }}
            </option>
        @endforeach
    </select>
    @error('category_id')
        <span class="invalid-feedback">{{ $message }}</span>
    @enderror
</div>