public function edit_building() { $id = Input::get('pk'); $value = Input::get('value'); $building = BuildingCatalog::where('id', '=', $id)->first(); $building->description = $value; if ($building->save()) { return Response::json(array('id' => $id, 'msg' => 'Datos guardados exitosamente')); } else { return Response::json(array('id' => $id, 'msg' => 'Error al tratar de guardar los datos')); } }
public function confirm_data_fam($code) { if (!$code) { $error_msg = new InvalidConfirmationCodeException(); return Redirect::action('UsersController@login')->with('error', $error_msg); } $confirm = InvitedNeighbors::where('Confirmation_code', '=', $code)->first(); if (!$confirm) { $error_msg = Lang::get('confide::confide.alerts.wrong_confirmation'); return Redirect::action('UsersController@login')->with('error', $error_msg); } if (!$confirm->confirmed) { $email = $confirm->email; $reg_user = User::where('email', '=', $email)->first(); if ($reg_user) { $reg_neighbor = Neighbors::where('user_id', '=', $reg_user->id)->first(); $property = NeighborProperty::where('neighbors_id', '=', $reg_neighbor->id)->first(); $urbanism_id = $confirm->urbanism_id; $urbanism = Urbanism::findOrFail($urbanism_id); $urbanism_name = $urbanism->name; $urbanism_type = $urbanism->urbanism_type_id; if ($urbanism_type == 3) { $catalog = BuildingCatalog::where('urbanism_id', '=', $urbanism_id)->first(); } else { $catalog = StreetCatalog::where('urbanism_id', '=', $urbanism_id)->first(); } $notice_msg = Lang::get('confide::confide.alerts.confirmation_invitation'); return View::make('dashboard.neighbors.edit_fam', ['email' => $email, 'urbanism' => $urbanism_name, 'urbanism_id' => $urbanism_id, 'code' => $code, 'urbanism_type' => $urbanism_type, 'catalog' => $catalog, 'neighbor' => $reg_neighbor, 'property' => $property, 'notice' => $notice_msg]); } else { return Redirect::action('ConfirmationController@confirm', $code); } } else { $notice_msg = 'Acceda a Habitaria con su usuario creado'; return Redirect::action('UsersController@login')->with('notice', $notice_msg); } }
public function register_neighbors() { $user = Input::get('user'); $urbanism_id = Input::get('urbanism_id'); $urbanism = Urbanism::findOrFail($urbanism_id); $urbanism_name = $urbanism->name; $urbanism_type = $urbanism->urbanism_type_id; if ($urbanism_type == 3) { $catalog = BuildingCatalog::where('urbanism_id', '=', $urbanism_id)->orderBy('id', 'ASC')->lists('description', 'id'); $select = '¿Piso donde vive?'; $select_name = 'name_floor'; } else { $catalog = StreetCatalog::where('urbanism_id', '=', $urbanism_id)->orderBy('id', 'ASC')->lists('name', 'id'); $select = '¿Calle donde vive?'; $select_name = 'name_street'; } return View::make('dashboard.neighbors.create_register', ['urbanism' => $urbanism_name, 'urbanism_id' => $urbanism_id, 'urbanism_type' => $urbanism_type, 'catalog' => $catalog, 'user' => $user, 'select_name' => $select_name, 'select' => ['' => $select]]); }