Fill a PHP select Laravel

0

I have this select function that what it does is select the customer table and select them by country, in which if you bring the data this in the Client's driver.

public function select(){ 
    $data = DB::select('select * from clientes where pais = ?', [51]);
    return view('file/create')->with('data',$data);
}

The route is as follows:

Route::get('select', 'ClienteController@select');

In the view I have something like this that is what I want it to fill.

<div class="selec-grupo">
    <select  selected="selected" name="select" value="">
    <option value="">Selecione un cliente</option>    
</div>

If they ask, I already do it with an @foreach but even then the data I want is not shown in the view. If they could help me and if something is not clear to them, I would be happy to ask if I can, to clarify myself better. Thanks

    
asked by Rojas Rodriguez Ricardo 25.10.2018 в 01:08
source

1 answer

0

Have you done it this way? Substituting value and value2 for the desired field.

<select id="developers">
    @foreach($developers as $select)
    <option value="{{ $developer->valor }}">{{ $developer->valor2 }}</option>
    @endforeach
</select>

I leave more information.

    
answered by 25.10.2018 / 01:36
source