public function run() { $faker = Faker::create(); Logs::truncate(); foreach (range(1, 500) as $index) { Logs::create(["ip" => $faker->localIpv4, "host" => $faker->domainName, "lastpage" => "", "last_visit" => $faker->dateTimeBetween($startDate = '-120 days', $endDate = 'now'), "created_at" => $faker->date($format = 'Y-m-d', $max = 'now') . ' ' . $faker->time($format = 'H:i:s', $max = 'now'), "updated_at" => $faker->date($format = 'Y-m-d', $max = 'now') . ' ' . $faker->time($format = 'H:i:s', $max = 'now'), "role_id" => $faker->numberBetween($min = 1, $max = 6), "data_id" => $faker->numberBetween($min = 1, $max = 11)]); } }
$logs = new Logs(); $logs->user_id = $user->id; $logs->platform = "WEB PORTAL"; $logs->type = "UPDATED ACCOUNT"; $logs->create(); $user->update(); $message = "Successfully saved."; } else { $message = "Username already exists."; } } else { $logs = new Logs(); $logs->user_id = $user->id; $logs->platform = "WEB PORTAL"; $logs->type = "UPDATED ACCOUNT"; $logs->create(); $user->update(); $message = "Successfully saved."; } } else { $message = "All fields are required."; } } else { if (isset($_POST['reset'])) { $message = "Successfully reset."; } } $hit = new Hit(); $hit->name = "account.php"; $hit->platform = "WEB PORTAL"; $hit->user_id = $session->is_logged_in() == true ? $session->user_id : 0;
/** * authanticate user during login. * * @return view */ public function validate() { $user = User::where("email", Input::get('email'))->first(); if ($user && $user->password == Input::get('password')) { if (Input::get('keep') == "cheked") { Auth::login($user, TRUE); } else { Auth::login($user, FALSE); } if (Auth::check()) { Logs::create(array("user_id" => Auth::user()->id, "action" => "Logging in")); return Redirect::to("home"); } } else { return View::make("login")->with("error", "Incorrect Username or Password"); } }
$accion = "Visito Mi Historial"; break; case 'dashboard/payments/neighbors': $accion = "Visito Mis Vecinos"; break; case 'dashboard/incomes/charge': $accion = "Visito Ingresos Cobrar"; break; case 'dashboard/incomes/record': $accion = "Visito Ingresos Historial"; break; case 'dashboard/incomes/charge/balances': $accion = "Visito Ingresos Saldos"; break; case 'dashboard/expenses': $accion = "Visito Egresos Registrar Gasto"; break; } if ($accion != '' and Auth::check()) { $colonia = Session::get("colonia"); $urbanism = Urbanism::where('colony_id', '=', $colonia)->first(); Logs::create(['user' => Auth::user()->Neighbors->name . ' ' . Auth::user()->Neighbors->last_name, 'rol_user' => Role::find(Auth::user()->AssigmentRole[0]->role_id)->name, 'urbanism_id' => $urbanism->id, 'user_email' => Auth::user()->email, 'accion' => $accion, 'fecha' => (new DateTime())->format('d-m-Y H:i:s')]); } return false; }); Event::fire('illuminate.controller'); Event::listen('logs', function ($accion) { $colonia = Session::get("colonia"); $urbanism = Urbanism::where('colony_id', '=', $colonia)->first(); Logs::create(['user' => Auth::user()->Neighbors->name . ' ' . Auth::user()->Neighbors->last_name, 'rol_user' => Role::find(Auth::user()->AssigmentRole[0]->role_id)->name, 'urbanism_id' => $urbanism->id, 'user_email' => Auth::user()->email, 'accion' => $accion, 'fecha' => (new DateTime())->format('d-m-Y H:i:s')]); });
public function store_followup($id) { $patient = Patient::find($id); $patient->first_name = Input::get("firstname"); $patient->middle_name = Input::get("middlename"); $patient->last_name = Input::get("lastname"); $patient->birth_date = Input::get("dob"); $patient->hospital_id = Input::get("hosp_no"); $patient->phone = Input::get("phone"); $patient->facility_id = Input::get("facility"); $patient->save(); //adding patient visit info $visit = Visit::create(array("patient_id" => $patient->id, "visit_date" => date('Y-m-d'), "server_status" => 'not', "user" => Auth::user()->firstname . " " . Auth::user()->middlename . " " . Auth::user()->lastname)); //adding address information PatientInfo::create(array("patient_id" => $patient->id, "visit_id" => $visit->id, "hospital_id" => "somenumber", "region" => Input::get("region"), "district" => Input::get("district"), "ward" => Input::get("ward"), "ten_cell_leader" => Input::get("t_cell_leadr"))); //adding gynecological history inforamtion for a visit GynecologicalHistory::create(array("patient_id" => $patient->id, "visit_id" => $visit->id, "parity" => Input::get("parity"), "number_of_pregnancy" => Input::get("number_of_preg"), "menarche" => Input::get("menarche"), "age_at_sexual_debut" => Input::get("start_sex_age"), "marital_status" => Input::get("marital"), "age_at_first_marriage" => Input::get("first_marriage"), "sexual_partner" => Input::get("sexual_partner"), "partner_sexual_partner" => Input::get("partner_sexual_partner"))); //adding contraceptive history ContraceptiveHistory::create(array("patient_id" => $patient->id, "visit_id" => $visit->id, "current_status" => Input::get("current_on_contra"), "current_contraceptive_id" => Input::has("current_contra") ? Input::get("current_contra") : "")); //adding HIV status HivStatus::create(array("patient_id" => $patient->id, "visit_id" => $visit->id, "status" => Input::has("hiv_status") ? Input::get("hiv_status") : "", "test_status" => Input::has("hiv_test_status") ? Input::get("hiv_test_status") : "", "unknown_reason" => Input::has("unknown_reason") ? Input::get("unknown_reason") : "", "years_since_first_diagnosis" => Input::has("year_since_diagnosis") ? Input::get("year_since_diagnosis") : "", "year_of_last_test" => Input::has("last_test") ? Input::get("last_test") : "", "art_status" => Input::has("art_status") ? Input::get("art_status") : "", "current_art_status" => Input::has("current_art_status") ? Input::get("current_art_status") : "", "pitc_offered" => Input::get("test_again") == "yes" ? "yes" : "no", "pitc_agreed" => Input::has("test_again") ? Input::get("test_again") : "", "pitc_result" => Input::has("current_test_result") ? Input::get("current_test_result") : "", "pitc_cd4_count" => Input::has("current_cd4") ? Input::get("current_cd4") : "", "prev_cd4_count" => Input::has("prev_cd4") ? Input::get("prev_cd4") : "")); //adding VIA Status ViaStatus::create(array("patient_id" => $patient->id, "visit_id" => $visit->id, "via_counselling_status" => Input::get("via_counceling"), "via_test_status" => Input::get("via_test"), "reject_reason" => Input::has("via_reason") ? Input::get("via_reason") : "", "via_result" => Input::has("via_results") ? Input::get("via_results") : "")); //adding colposcopy ColposcopyStatus::create(array("patient_id" => $patient->id, "visit_id" => $visit->id, "status" => Input::get("colposcopy_status"), "result_id" => Input::has("colpo_result") ? Input::get("colpo_result") : "")); //adding Pap smear result PapsmearStatus::create(array("patient_id" => $patient->id, "visit_id" => $visit->id, "status" => Input::get("pap_status"), "result_id" => Input::has("pap_result") ? Input::get("pap_result") : "")); //adding intervetion status Intervention::create(array("patient_id" => $patient->id, "visit_id" => $visit->id, "type_id" => Input::has("intervention") ? Input::get("intervention") : "", "indicator_id" => Input::has("indicator") ? Input::get("indicator") : "", "histology_id" => Input::has("histology") ? Input::get("histology") : "", "cancer_id" => Input::has("cancer") ? Input::get("cancer") : "", "grade" => Input::has("hist_grade") ? Input::get("hist_grade") : "", "stages" => Input::has("stages") ? Input::get("stages") : "", "differentiation" => Input::has("differentiation") ? Input::get("differentiation") : "")); $report = PatientReport::where('patient_id', $patient->id)->first(); $report->region = Input::get("region"); $report->district = Input::get("district"); $report->number_of_pregnancy = Input::get("number_of_preg"); $report->marital_status = Input::get("marital"); $report->first_marriage = Input::get("first_marriage"); $report->partners = Input::get("sexual_partner"); $report->partners_partner = Input::get("partner_sexual_partner"); $report->contraceptive_status = Input::get("current_on_contra"); $report->facility_id = Input::get("facility"); if (Input::has("current_contra")) { $report->contraceptive_type = Input::get("current_contra"); } if (Input::has("hiv_status")) { $report->HIV_status = Input::get("hiv_status"); } if (Input::has("current_cd4")) { $report->cd4_count = Input::get("current_cd4"); } elseif (Input::has("prev_cd4")) { $report->cd4_count = Input::has("prev_cd4"); } $report->save(); if (Input::get("next_visit") != "") { Notification::create(array("patient_id" => $patient->id, "message" => "Kumbuka Kwenda katika kituo ulichopimwa mara ya mwisho saratani ya shingo ya kizazi. Tafadhali fika bila kukosa tarehe " . Input::get('next_visit'), "status" => "pending", "phone_number" => $patient->phone, "next_visit" => Input::get('next_visit'))); } Logs::create(array("user_id" => Auth::user()->id, "action" => "Patient followup for " . $patient->first_name . " " . $patient->last_name)); $msg = "Patient followup stored successfull"; return View::make('visit.index', compact('patient', "msg")); }
public static function LogMsg($LogType, $KitTypeID, $KitID, $ContentsID, $Message) { $log = Logs::create(array('LogDate' => new DateTime('today'), 'LogType' => $LogType, 'LogKey1' => $KitTypeID, 'LogKey2' => $KitID, 'LogKey3' => $ContentsID, 'LogUserID' => Auth::user()->id, 'LogMessage' => $Message)); return $log->ID; }
/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update($id) { $users = User::find($id); $users->first_name = Input::get("first_name"); $users->last_name = Input::get("last_name"); $users->middle_name = Input::get("middle_name"); $users->access = Input::get("role"); $users->email = Input::get("email"); $users->phone = Input::get("phone"); // $user->gender = Input::get("gender"); $users->save(); $name = $users->first_name . " " . $users->middle_name . " " . $users->last_name; Logs::create(array("user_id" => Auth::user()->id, "action" => "Update user named " . $name)); return "Successfully updated"; }
<?php require_once "../../includes/initialize.php"; global $session; if (!$session->is_logged_in()) { redirect_to("../../index.php"); } if ($_POST['oper'] == 'add') { $log = new Logs(); $log->user_id = $_POST['user_id']; $log->platform = $_POST['platform']; $log->date = $_POST['date']; $log->type = $_POST['type']; $log->create(); } else { if ($_POST['oper'] == 'edit') { $log = Logs::get_by_id($_POST['id']); $log->user_id = $_POST['user_id']; $log->platform = $_POST['platform']; $log->date = $_POST['date']; $log->type = $_POST['type']; $log->update(); } else { if ($_POST['oper'] == 'del') { Logs::get_by_id($_POST['id'])->delete(); } } }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $facility = Facility::find($id); $name = $facility->facility_name; $facility->delete(); Logs::create(array("user_id" => Auth::user()->id, "action" => "Delete facility named " . $name)); }