Commit 8deab9d0 authored by sandroresende's avatar sandroresende

correcao limite usuario

parent 024efa2b
...@@ -57,8 +57,27 @@ class EntePublicoController extends Controller ...@@ -57,8 +57,27 @@ class EntePublicoController extends Controller
DB::beginTransaction(); DB::beginTransaction();
$where = [];
$where[] = ['ente_publico_id', $request->txt_cnpj];
$where[] = ['status_usuario_id', '<=', 2];
$enteUsuarios = User::where($where)->get();
if(count($enteUsuarios) > 5){
DB::rollBack();
flash()->erro("Erro", "Este Ente Público já atingiu o limite de 5 usuários para acesso ao sistema.");
return back();
}
$possuiUsuarioCPF = User::where('txt_cpf_usuario',$request->txt_cpf_usuario)->get(); $possuiUsuarioCPF = User::where('txt_cpf_usuario',$request->txt_cpf_usuario)->get();
$possuiUsuarioEmail = User::where('email',$request->email)->get(); $possuiUsuarioEmail = User::where('email',$request->email)->get();
if(count($possuiUsuarioCPF) > 0){ if(count($possuiUsuarioCPF) > 0){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment