public function update($id, Request $request) { $pagamento = Pagamento::where('id', '=', $id)->first(); $request->merge(['valor' => str_replace(',', '.', preg_replace('#[^\\d\\,]#is', '', $request->get('valor')))]); if ($pagamento->validate($request->all())) { $pagamento->update($request->all()); return redirect(route('listar-pagamento')); } else { return redirect(route('editar-pagamento'))->withInput()->withErrors($pagamento->errors()); } }
public function detalhesPagamentoClonado(Pagamento $p, $data, $hora, $cod_barras) { $qry_cod_barras = $p->where("pag_cod_barras", "like", "%" . $cod_barras . "%")->get(); $qry_data_hora = $p->where(function ($query) use($data, $hora) { $query->where("pag_hora", "=", "%" . $hora . "%")->where("pag_data", "=", "%" . $data . "%"); })->get(); $testa_cod_barras = count($qry_cod_barras); $testa_data_hora = count($qry_data_hora); if ($testa_data_hora > 0) { return $qry_data_hora; } else { if ($testa_cod_barras) { return $qry_cod_barras; } } //dd($v); }