Exemplo n.º 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')]);
     }
 }
 /**
  * Updates Student into database
  *
  * @param Student $student
  * @param array $input
  *
  * @return Student
  */
 public function update($student, $input)
 {
     $student->fill($input);
     $student->save();
     return $student;
 }