public function postEditParents($id)
 {
     $user = User::find($id);
     $father = Parents::where(function ($q) use($id) {
         $q->where('user_id', $id);
         $q->where('parent_id', 1);
     })->first();
     $mother = Parents::where(function ($q) use($id) {
         $q->where('user_id', $id);
         $q->where('parent_id', 2);
     })->first();
     $father->update(['firstname' => Input::get('fatherfirstname'), 'middlename' => Input::get('fathermiddlename'), 'lastname' => Input::get('fatherlastname'), 'address' => Input::get('fatheraddress')]);
     $mother->update(['firstname' => Input::get('motherfirstname'), 'middlename' => Input::get('mothermiddlename'), 'lastname' => Input::get('motherlastname'), 'address' => Input::get('motheraddress')]);
     $audit = AuditTrail::create(['user_id' => Auth::id(), 'role' => 'Employee Management Admin', 'action' => 'edited ' . $user->firstname . ' ' . $user->lastname . '\'s Parent Information.']);
     return Redirect::route('profile', $id)->with('alert', 'success|Parent Information has been successfully updated')->with('father', $father)->with('mother', $mother);
 }
示例#2
0
 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;
 }