amitshrestha221's avatar

How to setup my database?

I am doing an E-commerce project. During the add product form I have this form


<form class="form-horizontal adminex-form" method="post" action="{{ route('coupons.addSubmit') }}">
                    <div class="form-group">
                        <label class="col-sm-2 col-sm-2 control-label">Product Name</label>
                        <div class="col-sm-10">
                            <input type="text" name="name" class="form-control" value="{{ old('name') }}">
                        </div>
                    </div>
                   
                    <div class="form-group">
                        <label class="col-sm-2 control-label col-lg-2" for="inputSuccess">Category</label>
                        <div class="col-lg-10">
                            <select id="category" class="form-control m-bot15">
                                <option value="">Select a category</option>
                                @forelse ($categories as $cat)
                                    <option value="{{ $cat->id }}">{{ $cat->category }}</option>
                                @empty
                                    <option value="">No categories found.</option>
                                @endforelse
                            </select>
                        </div>
                    </div>

                    <div id="subcat">
                        
                    </div>

                    @include('products::extras')

                    <div class="form-group">
                        <label class="col-sm-2 col-sm-2 control-label">Price</label>
                        <div class="col-sm-10">
                            <input type="text" name="price" class="form-control" value="{{ old('price') }}">
                        </div>
                    </div>

/*-- Other General Fields --*/

                </form>


In my extras view, which is rendered on the basis of the subcategory, I have static fields like this..


{{-- Clothing --}}

<div id="30" class="extras" style="display:none;">
    
</div>

{{-- Shoes --}}

<div id="24" class="extras" style="display:none;">
    
</div>


/*-- Other divs --*/


How do I setup my database for my extra attributes..

0 likes
3 replies
amitshrestha221's avatar

@tisuchi Nope bro.. I have already sorted out that.. I am confused with product fields section:

I have created product table with


id  name    category_id subcategory_id  price       quantity


and other general fields


I'm confused with the other extras fields like


watches => strap material, strap type
eyewear => lens color, frame color, lens material, frame material
others


Please or to participate in this conversation.