GeorgeMartins
1 year ago
40
15
Laravel

Search the database but does not pass the value

Posted 1 year ago by GeorgeMartins

Good Morning, I have the following function in the controller to search my table and return the data found.

Is my controller

$clientes = DB::table('cliente')->pluck('razaosocial', 'id');
return view('admin.contrato.create', ['cliente' => $clientes]);

In my view it is like 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, it shows me the data but does not pass the value found. Does anyone know how I can pass the found value in String form?

Please sign in or create an account to participate in this conversation.