コード例 #1
0
 public function updateRepresentative($id)
 {
     $input = Input::all();
     /*echo "<pre>";
     		print_r($input);
     		die();*/
     foreach ($input['array'] as $key => $value) {
         $record = CustomerRepresentative::find($value['id']);
         $record->first_name = $value['first_name'];
         $record->middle_initial = $value['middle_initial'];
         $record->last_name = $value['last_name'];
         $record->company_position = $value['company_position'];
         $record->save();
         $email = ContactInfo::find($value['email_id']);
         $email->email = $value['email'];
         $email->save();
         $number = ContactNumber::find($value['number_id']);
         $number->number = $value['number'];
         $number->save();
         /*$contact = Contact::find($email->contact_id);
         		$contact->number = $value['new_number'];
         		$contact->save();*/
     }
     return Redirect::back()->with('message', 'Updated representative info')->with('alert-class', 'success');
 }
コード例 #2
0
 public function postDelete()
 {
     $info = ContactInfo::find(Input::get('id'));
     if ($info->delete()) {
         return Redirect::back()->with('event', '<p class="alert alert-success"><span class="glyphicon glyphicon-ok"></span> Contact info has been deleted successfully</p>');
     }
     return Redirect::back()->with('event', '<p class="alert alert-danger"><span class="glyphicon glyphicon-remove"></span> Error occured. Please try again</p>');
 }