예제 #1
0
 public function index_onDelete()
 {
     if (($checkedIds = post('checked')) && is_array($checkedIds) && count($checkedIds)) {
         foreach ($checkedIds as $contactId) {
             if (!($contact = Contact::find($contactId))) {
                 continue;
             }
             $contact->delete();
             // Delete Also on Contacts Projects
             DB::table('johng_sm_contacts_projects')->where('contact_id', $contactId)->delete();
         }
         Flash::success(Lang::get('johngerome.sm::lang.contacts.delete_contacts_success'));
     }
     return $this->listRefresh();
 }
예제 #2
0
 public function onAddSubscriber()
 {
     $error = false;
     $message = 'Thank You for Subscribing';
     $project_id = post('project');
     $data = ["email" => post('email'), "firstname" => post('firstname'), "lastname" => post('lastname'), "latitude" => post('latitude'), "longitude" => post('longitude'), "contact_att" => post('contact_att'), "debug" => post('debug') ? post('debug') : false];
     try {
         if (!Project::find($project_id)) {
             $error = true;
             $message = 'Project Not Found!';
         } else {
             // Add Contact to the Database.
             $contact = Contact::create($data);
             $contact->projects()->attach($project_id);
             // Send eMail
             $sm = $this->onSendMail($data);
             $this->page['result'] = $message;
         }
     } catch (\Exception $e) {
         $this->page['error'] = $error;
         $this->page['result'] = $e->getMessage();
     }
 }