 public function Empenhos(Request $request) {     $dateinit = \Carbon\Carbon::parse($request->dateini);     $datefim = \Carbon\Carbon::parse($request->datefim);      $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', '>=', $dateinit->format('d/m/Y'));     if ($request->datefim) $query->where('emp.date', '>=', $dateinit->format('d/m/Y'))