0
I’m doing a search in my database, I want to take the value found and save it (are two different tables) but the value is not being saved, is being saved the number 0.
I use this command in my controller:
$clientes = DB::table('cliente')->pluck('razaosocial', 'id');
return view('admin.contrato.create', ['cliente' => $clientes]);
And in my view I use this:
<div class="form-group col-md-5">
{{ Form::label('cliente', 'Cliente') }}
<select class="js-example-basic-multiple" name="cliente_id" >
<option selected>Selecione o cliente</option>
@foreach ($cliente as $cli)
<option value="{{ $cli }}">{{ $cli }}</option>
@endforeach
</select>
</div>
When I use it, I see the data, but I can’t save it. I don’t know much about PHP, someone knows how I can solve it?
Law a little about Eloquent in this link: https://laravel.com/docs/5.6/eloquent and see how the objects are persisted in the bank
– LSA