-1
I am not able to edit the registry with single emails always says that the value already exists when I try to save the record.
URL:
http://dominio/dashboard/admin/franqueados/11/edit
REQUEST:
public function rules()
{
$id = $this->segment(4);
$data = [
'nome' => 'required|max:255',
'document_number' => 'cnpj',
'cep' => 'required',
'logradouro' => 'required',
'bairro' => 'required',
'cidade' => 'required',
'estado' => 'required',
'numero' => 'required',
'banco' => 'required',
'agencia' => 'required',
'conta' => 'required',
'email' => "required|email|unique:users,email,{$id},id",
'telefone' => 'required',
];
return $data;
}
CONTROLLLER:
public function update(FranquedoRequest $request, $id)
{
$data = $request->all();
$this->franqueado->findOrfail($id)->update($data);
$request->session()->flash('message', 'Franqueado atualizado com sucesso');
return redirect()->back();
}