lundi 9 juillet 2018

Laravel forms, multiselect saving into different rows in database

I have a multiselect, code is below for the multiselect within my blade.

          
    <select multiple="multiple" name="server_id[]" id="server_id" class="form-control form-control-md">
        @foreach($servers as $key => $name)
            <option value=""></option>
        @endforeach
    </select

The issue I am running into is I need each of the selected values to be saved within a different row in the database. As you can see right now the key is being saved witihin the server_id[] (Right now it throws an error on save because of unsupported operand type)

But I need each of the items within server_id[] to be saved within their own database entry so they can be easily referred to later. How could one go about doing that, I cant seem to figure it out?

If you need my migrations or controllers I would be happy to add them!



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2ue2MH6
via IFTTT

Aucun commentaire:

Enregistrer un commentaire