I'm trying to make a select
button on the blade with @foreach
to get the list of all MySql databases. Only @foreach
works, I can get the values, but I can not put the bases inside select
. It is giving error:
htmlspecialchars () expects parameter 1 to be string, object given (View: C: \ Generator \ resources \ views \ generators \ create.blade.php)
My controller:
public function create(Request $request)
{
$tables = DB::select('SHOW TABLES');
//dd($tables);
//GeradorController->criacontroller($request);
return view("geradors.create",['tables'=>$tables]);
}
My View:
<div class="col-md-2">
<div class="panel panel-default">
<div class="panel-heading">Tabelas:</div>
@foreach($tables as $table)
{{ $table }}
@endforeach
<select name="tables">
{!! Form::select('table', $table, ['class' => 'form-control']) !!}
</select>
</div>
</div>