| @@ 104-116 (lines=13) @@ | ||
| 101 | * @return array |
|
| 102 | * @throws \Exception |
|
| 103 | */ |
|
| 104 | public function createTask($input) |
|
| 105 | { |
|
| 106 | $data = vs::validateInputOnCreateTask($input); |
|
| 107 | $repository = new TaskRepository; |
|
| 108 | $query = $repository->createTaskQuery(); |
|
| 109 | $statement = $this->database->prepare($query); |
|
| 110 | $statement->bindParam('task', $data['task']); |
|
| 111 | $statement->bindParam('status', $data['status']); |
|
| 112 | $statement->execute(); |
|
| 113 | $task = $this->checkTask($this->database->lastInsertId()); |
|
| 114 | ||
| 115 | return $task; |
|
| 116 | } |
|
| 117 | ||
| 118 | /** |
|
| 119 | * Update a task. |
|
| @@ 102-114 (lines=13) @@ | ||
| 99 | * @return array |
|
| 100 | * @throws \Exception |
|
| 101 | */ |
|
| 102 | public function createUser($input) |
|
| 103 | { |
|
| 104 | $data = vs::validateInputOnCreateUser($input); |
|
| 105 | $repository = new UserRepository; |
|
| 106 | $query = $repository->createUserQuery(); |
|
| 107 | $statement = $this->database->prepare($query); |
|
| 108 | $statement->bindParam('name', $data['name']); |
|
| 109 | $statement->bindParam('email', $data['email']); |
|
| 110 | $statement->execute(); |
|
| 111 | $user = $this->checkUser($this->database->lastInsertId()); |
|
| 112 | ||
| 113 | return $user; |
|
| 114 | } |
|
| 115 | ||
| 116 | /** |
|
| 117 | * Update a user. |
|