예제 #1
0
 /**
  * @param $name
  * @param $email
  * @param $request
  * @param $workshop
  */
 private function saveUser($name, $email, $request, $workshop)
 {
     $user = new Student();
     if (!Student::isStudent($name, $email)) {
         $user->fill($request);
         $user->status = 'C';
         $user->profile = $this->getUserProfileString($request);
         $user->save();
     } else {
         $user = $user->getByEmailAndName($name, $email);
     }
     if (!$user->isRegistered($name, $email, $workshop->id)) {
         $user->workshops()->attach($workshop->id, ['sign_date' => date('Y-m-d H:i:s')]);
     }
 }
예제 #2
0
 /**
  * Add contact to wordpress newsletter
  * @param ContactEvent $event
  * @param $newsletter string
  * @param $name string
  * @param $email string
  */
 private function saveUser(ContactEvent $event, $newsletter, $name, $email)
 {
     if ($newsletter != 'newsletter') {
         return;
     }
     $this->name_split($name);
     $this->addEmailToList($email, $name);
     if (Student::isStudent($name, $email)) {
         return;
     }
     $newsletter_class = Student::create($event->getRequest()->all());
     $newsletter_class->status = 'C';
     $newsletter_class->save();
 }