public function postEditContactInfo($id) { $user = User::find($id); $cont = ContactInfo::where('user_id', $id)->first(); $validator = Validator::make(Input::all(), ContactInfo::$rules); if ($validator->fails()) { return Redirect::route('emp.edit-contactinfo', $cont->user_id)->withErrors($validator)->withInput(); } $cont->update(['homenum' => Input::get('homenum'), 'officenum' => Input::get('officenum'), 'mobilenum' => Input::get('mobilenum'), 'street' => Input::get('street'), 'city' => Input::get('city')]); $audit = AuditTrail::create(['user_id' => Auth::id(), 'role' => 'Employee Management Admin', 'action' => 'edited ' . $user->firstname . ' ' . $user->lastname . '\'s Contact Information.']); return Redirect::route('profile', $id)->with('alert', 'success|Contact Info has been updated.'); }
public function contact() { return View::make('users.contact-us')->with('contact', ContactInfo::where('status', '=', 1)->get())->with('facebooks', ContactInfo::select('facebook')->where('status', '=', 1)->get())->with('twitters', ContactInfo::select('twitter')->where('status', '=', 1)->get())->with('googles', ContactInfo::select('google')->where('status', '=', 1)->get()); }
public function getUserPdf($id) { $user = User::find($id); $comids = CommonId::where('user_id', $user->id)->first(); $cont = ContactInfo::where('user_id', $user->id)->first(); $parents = Parents::where('user_id', $user->id)->get(); $schools = School::where('user_id', $user->id)->first(); if ($user->gender == 'Male') { $gender = 'his'; } else { $gender = 'her'; } $audit = AuditTrail::create(['user_id' => Auth::id(), 'role' => 'User', 'action' => 'printed ' . $gender . ' User Information']); if (!$user) { App::abort(404); } Fpdf::AddPage(); Fpdf::PageNo(); Fpdf::AliasNbPages('{nb}'); Fpdf::Image('img/dap.jpg', 10, 5, 150); Fpdf::SetFont('Arial', 'B', 10); Fpdf::Ln(25); Fpdf::Cell(300, 10, 'Date Generated: ' . date("F j, Y"), 0, 2, 'C', 0); Fpdf::SetFont('Arial', 'B', 18); Fpdf::Ln(10); Fpdf::Cell(190, 10, $user->formatName(':fn :ln'), 0, 2, 'C', 0); Fpdf::SetFont('Arial', 'B', 9.5); Fpdf::SetTextColor(0, 0, 0); Fpdf::Cell(80, 10, 'Personal Information', 0, 0, 'C', 0); Fpdf::Cell(80, 10, 'Common ID', 0, 1, 'C', 0); Fpdf::SetTextColor(0, 0, 0); Fpdf::SetFont('Arial', '', 8.5); Fpdf::Cell(80, 10, 'Email: ' . $user->email, 0, 0, 'L', 0); Fpdf::Cell(80, 10, 'TIN ID: ' . $comids->tin, 0, 1, 'L', 0); Fpdf::Cell(80, 10, 'Username: '******'L', 0); Fpdf::Cell(80, 10, 'Philhealth: ' . $comids->philhealth, 0, 1, 'L', 0); Fpdf::Cell(80, 10, 'Birthday: ' . $user->birthday, 0, 0, 'L', 0); Fpdf::Cell(80, 10, 'Pag IBIG: ' . $comids->pagibig, 0, 1, 'L', 0); Fpdf::Cell(80, 10, 'Gender: ' . $user->gender, 0, 0, 'L', 0); Fpdf::Cell(80, 10, 'SSS: ' . $comids->sss, 0, 1, 'L', 0); Fpdf::Cell(80, 10, 'Department: ' . $user->department->name, 0, 0, 'L', 0); //Fpdf::Cell(80,10,'Common ID',0,2,'C',0); Fpdf::Ln(15); Fpdf::SetFont('Arial', 'B', 9.5); Fpdf::SetFillColor(90, 90, 90); Fpdf::SetTextColor(0, 0, 0); Fpdf::Cell(150, 10, 'Parents', 0, 1, 'C', 0); foreach ($parents as $parent) { if ($parent->parent_id == 1) { Fpdf::SetFont('Arial', '', 8.5); Fpdf::Cell(10, 10, 'Father', 0, 0, 'C', 0); } else { Fpdf::SetFont('Arial', '', 8.5); Fpdf::Cell(10, 10, 'Mother', 0, 0, 'C', 0); } Fpdf::Cell(65, 10, 'Name: ' . $parent->firstname . " " . $parent->lastname, 0, 0, 'L', 0); Fpdf::Cell(65, 10, 'Address: ' . $parent->address, 0, 1, 'L', 0); } Fpdf::Ln(15); Fpdf::SetFont('Arial', 'B', 9.5); Fpdf::Cell(150, 10, 'Contact Info', 0, 1, 'C', 0); Fpdf::SetFont('Arial', '', 8.5); Fpdf::Cell(80, 10, 'Home Number: ' . $cont->homenum, 0, 0, 'L', 0); Fpdf::Cell(80, 10, 'Office Number: ' . $cont->officenum, 0, 1, 'L', 0); Fpdf::Cell(80, 10, 'Mobile Number: ' . $cont->mobilenum, 0, 0, 'L', 0); Fpdf::Cell(80, 10, 'Street: ' . $cont->street, 0, 1, 'L', 0); Fpdf::Cell(80, 10, 'City: ' . $cont->city, 0, 0, 'L', 0); Fpdf::Ln(5); Fpdf::Ln(5); Fpdf::SetFont('Arial', 'B', 9.5); Fpdf::SetFillColor(90, 90, 90); Fpdf::SetTextColor(0, 0, 0); Fpdf::Cell(180, 10, 'School', 0, 1, 'C', 0); Fpdf::SetTextColor(0, 0, 0); Fpdf::SetFont('Arial', '', 8.5); Fpdf::Cell(65, 10, 'Primary', 0, 0, 'C', 0); Fpdf::Cell(65, 10, 'Secondary', 0, 0, 'C', 0); Fpdf::Cell(65, 10, 'Tertiary', 0, 1, 'C', 0); Fpdf::Cell(65, 10, 'School: ' . $schools->primary_name, 0, 0, 'L', 0); Fpdf::Cell(70, 10, 'School: ' . $schools->secondary_name, 0, 0, 'L', 0); Fpdf::Cell(70, 10, 'School: ' . $schools->tertiary_name, 0, 1, 'L', 0); Fpdf::Cell(65, 10, 'Address: ' . $schools->primary_address, 0, 0, 'L', 0); Fpdf::Cell(70, 10, 'Address: ' . $schools->secondary_address, 0, 0, 'L', 0); Fpdf::Cell(70, 10, 'Address: ' . $schools->tertiary_address, 0, 1, 'L', 0); Fpdf::Cell(65, 10, 'Years: ' . $schools->primary_years, 0, 0, 'L', 0); Fpdf::Cell(70, 10, 'Years: ' . $schools->secondary_years, 0, 0, 'L', 0); Fpdf::Cell(70, 10, 'Years: ' . $schools->tertiary_years, 0, 1, 'L', 0); Fpdf::SetY(-30.5); Fpdf::SetFont('Arial', 'I', 6); Fpdf::SetTextColor(0, 0, 0); Fpdf::Cell(0, 10, 'Page ' . Fpdf::PageNo() . "/{nb}", 0, 0, 'C'); Fpdf::Output(); exit; }