Last active
March 7, 2019 22:59
-
-
Save raank/d9f1ec3b1f43d6163d5fa82082b54d36 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 index() | |
{ | |
return view('home', [ | |
'seguidores' => [ | |
'instagram' => ''// query para inseriros seguidores do instagram | |
'facebook' => ''// query para inseriros seguidores do facebook | |
] | |
]); | |
public function store(Request $request) | |
{ | |
foreach ($request->redesSociais as $rede => $values) { | |
$rede = new RedesSociais(); | |
$rede->tipo_redes_id = 1; | |
$rede->url = $values['url_rede']; | |
$rede->descricao = "Teste"; | |
$rede->seguidores_influenciadores_id = $values['seguidores_rede']; | |
// save | |
$influenciadores->redes()->save($rede); | |
} | |
} | |
} |
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 | |
@php | |
$redes = ['intagram', 'facebook']; | |
@endphp | |
@foreach($redes as $rede) | |
<input | |
type="url" | |
class="form-control" | |
value="{{ old(sprintf('redesSociais.%s.url_rede', $rede)) }}" | |
id="url_{{ $rede }}" | |
name="{{ sprintf('redesSociais[%s][url_rede]', $rede) }}" | |
placeholder="Digite a URL do {{ ucfirst($rede) }}"> | |
<select class="form-control select2" name="{{ sprintf('redesSociais[%s][seguidores_rede]', $rede) }}" style="width: 100%;"> | |
<option selected>Selecione</option> | |
@foreach ($seguidores[$rede] as $item) | |
<option value="{{ $item->id }}" @if(old(sprintf('redesSociais.%s.seguidores_rede', $rede)) === $item->id) selected @endif>{{ $item->estimativa_seguidores }}</option> | |
@endforeach | |
</select> | |
@endforeach | |
</form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment