public function postCadastrojuridica()
 {
     if (count(ORGAssociates::where('email', '=', Input::get('login'))->get()) > 0) {
         return Redirect::to(self::$route . '/cadastrojuridica')->with(array('msg_error' => 'Email Cadastrado'));
     } elseif (count(User::where('email', '=', Input::get('login'))->get()) > 0) {
         return Redirect::to(self::$route . '/cadastrojuridica')->with(array('msg_error' => 'Email Cadastrado'));
     } else {
         $org_associate = new ORGAssociates();
         $org_associate->email = Input::get('login');
         $org_associate->senha = md5(Input::get('password'));
         $org_associate->tipo_pessoa = 'J';
         $org_associate->save();
         $user = new User();
         $user->email = Input::get('login');
         $user->password = Hash::make(Input::get('password'));
         $user->type = 'associate';
         $user->status = 'publish';
         $user->save();
         $associate = new Associates();
         $associate->email = Input::get('login');
         $associate->password = md5(Input::get('password'));
         $associate->user = $user->id;
         $associate->associate = $org_associate->id_asociado;
         $associate->type = 'associate';
         $associate->status = 'publish';
         $associate->save();
         Auth::user()->login($user);
         return Redirect::to(self::$route);
     }
 }
예제 #2
0
 public function postCreate()
 {
     $associate = new ORGAssociates();
     $category = ORGAssociateCategories::find(Input::get('categoria'));
     $associate->nombre_completo = Input::get('nombre_completo');
     $associate->email = Input::get('email');
     $associate->edo_civil = Input::get('edo_civil');
     $associate->passaporte = Input::get('passaporte');
     $associate->institucion = Input::get('institucion');
     $associate->empresa = Input::get('empresa');
     $associate->rg = Input::get('rg');
     $associate->tipo_correspondencia = Input::get('tipo_correspondencia');
     $associate->data_nascimento = date('Y-m-d', strtotime(Input::get('data_nascimento')));
     $associate->sexo = Input::get('sexo');
     $associate->senha = md5(Input::get('senha'));
     $associate->web_site = Input::get('web_site');
     $associate->categoria = Input::get('categoria');
     $associate->tipo_pessoa = $category->tipo_usuario;
     $associate->cargo = Input::get('cargo');
     $associate->cpf = Input::get('cpf');
     /*		
     $associate->status_asso = Input::get('status_asso');
     $associate->es_associado = 1;
     $associate->estado_matricula = Input::get('estado_matricula');
     $associate->codigo_matricula = Input::get('codigo_matricula');
     $associate->tipo_pessoa = Input::get('tipo_pessoa');
     $associate->formacao = Input::get('formacao');
     $associate->razon_social = Input::get('razon_social');
     $associate->cpf = Input::get('cpf');
     $associate->cnpj = Input::get('cnpj');
     $associate->web_site = Input::get('web_site');
     $associate->responsavel = Input::get('responsavel');
     $associate->observacao = Input::get('observacao');
     */
     $associate->cep_res = Input::get('cep_res');
     $associate->numero_res = Input::get('numero_res');
     $associate->complemento_res = Input::get('complemento_res');
     $associate->pais_res = Input::get('pais_res');
     $associate->logradouro_res = Input::get('logradouro_res');
     $associate->dir_res = Input::get('dir_res');
     $associate->bairro_res = Input::get('bairro_res');
     $associate->ciudad_internacional_res = Input::get('ciudad_internacional_res');
     $associate->ddd_res = Input::get('ddd_res');
     $associate->ddi_res = Input::get('ddi_res');
     $associate->telefone_res = Input::get('telefone_res');
     $associate->ddd_two_res = Input::get('ddd_two_res');
     $associate->ddi_two_res = Input::get('ddi_two_res');
     $associate->telefone_seg_res = Input::get('telefone_seg_res');
     $associate->ddd_cel_res = Input::get('ddd_cel_res');
     $associate->ddi_cel_res = Input::get('ddi_cel_res');
     $associate->celular_res = Input::get('celular_res');
     $associate->cep_com = Input::get('cep_com');
     $associate->numero_com = Input::get('numero_com');
     $associate->complemento_com = Input::get('complemento_com');
     $associate->pais_com = Input::get('pais_com');
     $associate->logradouro_com = Input::get('logradouro_com');
     $associate->dir_com = Input::get('dir_com');
     $associate->bairro_com = Input::get('bairro_com');
     $associate->ciudad_internacional_com = Input::get('ciudad_internacional_com');
     $associate->ddd_com = Input::get('ddd_com');
     $associate->ddi_com = Input::get('ddi_com');
     $associate->telefone_com = Input::get('telefone_com');
     $associate->ddd_two_com = Input::get('ddd_two_com');
     $associate->ddi_two_com = Input::get('ddi_two_com');
     $associate->telefone_seg_com = Input::get('telefone_seg_com');
     $associate->ddd_cel_com = Input::get('ddd_cel_com');
     $associate->ddi_cel_com = Input::get('ddi_cel_com');
     $associate->celular_com = Input::get('cel_com');
     $associate->data_cadastro = date('Y-m-d');
     $associate->codigo_matricula = Input::get('codigo_matricula');
     $associate->status_asso = Input::get('status_asso');
     if ($associate->save()) {
         $academic = new ORGAcademics();
         $academic->tipo_graduacion = Input::get('tipo_graduacion');
         $academic->institucion = Input::get('institucion');
         $academic->facultad = Input::get('facultad');
         $academic->curso_realizado = Input::get('curso_realizado');
         $academic->ano_inicio = Input::get('ano_inicio');
         $academic->ano_finalizacion = Input::get('ano_finalizacion');
         $academic->id_asociado = $associate->id_asociado;
         $academic->save();
         return Redirect::to($this->route)->with('msg_success', Lang::get('messages.associates_create', array('title' => $associate->nombre_completo)));
     } else {
         return Redirect::to($this->route)->with('msg_error', Lang::get('messages.associates_create_err', array('title' => $associate->nombre_completo)));
     }
 }