无限字段,但在Laravel / HTML中具有相同的名称

I basically want to submit multiple/unlimited amounts of "data" for the same form element, an example image HTML version of the form field would look like: enter image description here

当前生成表单的后端如下所示:

{{ html()->label(__('validation.attributes.frontend.sponsors'))->for('sponsor') }}
<div class="form-row">
    <div class="col">
        {{ html()->input('sponsor[1][name]')->class('form-control')->placeholder('Sponsor Name') }}
    </div>
    <div class="col">
        {{ html()->input('sponsor[1][website]')->class('form-control')->placeholder('Sponsor Website') }}
    </div>
    <div class="col">
        <div class="custom-file">
            {{ html()->file('sponsor[1][file]')->class('form-control custom-file-input') }}
            {{ html()->label('Sponsor Logo')->class('custom-file-label') }}
        </div>
    </div>
    <div class="col">
        {{ html()->button('addSponsor')->type('button')->html('<span class="fas fa-plus"></span>')->class('btn btn-success btn-xs') }}
    </div>
</div><!--row-->

How can I add it so I can duplicate the row using jQuery etc.. and then handle it so they're grouped as sponsors rather than linking name[][1] to website[][1]

快速总结

我需要能够添加无限数量的赞助者(名称,网站,图像),然后使用Laravel处理表单。

评论