I have a problem sending a query in a select it marks me the error htmlentities () expects parameter 1 to be string, object given
My Controller is this:
$works = ContractWork::get();
$year = DB:: table('contract_works')
->select(DB::raw('Year(dateFailure) as dt'))
->groupBy('dt')
->orderBy('dt','asc')
->get();
$thearray = (array) $year;
return view('contratoObra.index',compact('works','year'));
My view where I send the variable is as follows:
{!!Form::open(['route' => 'contratoObra.index', 'method' => 'GET', 'class' => 'navbar-form navbar-right pull-right'])!!}
<div class="form-group" >
<div class="col-md-2 form-group">
{!!Form::select('year', $year, null, ['placeholder' => 'Todo...' ])!!}
</div>
</div>
{!!Form::submit('Filtrar',['class'=>'btn btn-primary'])!!}
{!!Form::close()!!}