Skip to content

Instantly share code, notes, and snippets.

@raank
Last active March 7, 2019 14:00
Show Gist options
  • Save raank/1f9fb0ea0c5785169a974661b33a752d to your computer and use it in GitHub Desktop.
Save raank/1f9fb0ea0c5785169a974661b33a752d to your computer and use it in GitHub Desktop.
<?php
class Controller
{
public function store(Request $request)
{
dd($request->redesSociais); // dumping
foreach ($request->redesSociais as $index => $rede) {
// $index = 0, 1, 2
// $rede = array de campos para cada rede
foreach ($rede as $key => $value) {
// $key = instagram, seguidores_instagram
// $value = url do instagram, id selecionado no select
}
}
}
}
<form action="/nova/redesocial" method="POST">
@csrf
<input
type="url"
class="form-control"
value="{{ old('redesSociais.1.instagram') }}"
id="instagram"
name="redesSociais[1][instagram]"
placeholder="https://www.instagram.com/">
<select class="form-control select2" name="redesSociais[1][seguidores_instagram]" style="width: 100%;">
<option selected>Selecione</option>
@foreach ($seguidores as $item)
<option value="{{ $item->id }}" @if(old('redesSociais.1.seguidores_instragram') === $item->id) selected @endif>{{ $item->estimativa_seguidores }}</option>
@endforeach
</select>
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment