Last active
March 7, 2019 14:00
-
-
Save raank/1f9fb0ea0c5785169a974661b33a752d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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