I'm trying to get the column type of the tables from my BD
, and how can I use PHP
with Laravel
I've tried using GetType
to get the types and show on view
. But the code is only returning Object
.
Here is the code:
Controller
$input = $request->all();
$tables = $request->input('tables');
$resultados = DB::select('select * from ' .$tables);
$colunas = array();
foreach($resultados as $resultado){
echo (getType($resultado));
$colunas[] = ((array)$resultado);
}
dd($colunas);
View
<div class="form-group">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
{!! Form::label('tables', 'Tabelas:', ['class' => 'control-label']) !!}
<br><br>
<select class="selectpicker form-control" name="tables" id="tables">
<option disabled selected> -- Selecione -- </option>
@foreach($tables as $table)
@foreach ($table as $key => $value)
<option value="{{ $value }}">{{ $value }}</option>
@endforeach
@endforeach
</select>
</div>
Is there any other way to get the type?