Good afternoon, if anyone can help me in this problem I will be grateful
I have the following form:
<div class="form-group col-md-12 col-sm-12 col-xs-12">
<div class="col-md-2 col-sm-2 col-xs-2 form-label">
{{Form::label('date', 'Data')}}
</div>
<div class="col-md-8 col-sm-10 col-xs-10">
<div class="input-group">
<span class="input-group-addon" id="interval">Inicial</span>
{{Form::text('dateini', null, ['class' => 'form-control'])}}
<span class="input-group-addon" id="interval">Final</span>
{{Form::text('datefim', null, ['class' => 'form-control'])}}
</div>
</div>
</div>
How do I put the date in the "d / m / Y" format before finishing this check in the controller?
public function Empenhos(Request $request)
{
$query = DB::table('empenho as emp')
->select('emp.nrEmpenho as a',DB::raw("DATE_FORMAT(emp.date, '%d/%m/%Y') as b"))
->orderby('emp.nrEmpenho');
if ($request->dateini) $query->where('emp.date', '>=', $request->dateini);
if ($request->datefim) $query->where('emp.date', '>=', $request->dateini)
->where('emp.date', '<=', $request->datefim);
$table = $query->paginate($request->perPage ? $request->perPage : 20);
$header = ['Numero', 'Data', 'Tipo', 'Credor', 'Ficha', 'Fonte', 'Valor'];
return view('results.planejamento.empenhos',
['perPage' => $request->perPage, 'title' => $this->title,
'title2' => $this->title2[6], 'header' => $header, 'table' => $table, 'return' => 'Empenhos']);
}
Note: Any questions about the code are available to provide you with any necessary information!