aboutsummaryrefslogtreecommitdiffhomepage
path: root/api/Users/Repositories/UserRepository.php
diff options
context:
space:
mode:
authorMarvin Borner2018-07-20 16:34:32 +0200
committerMarvin Borner2018-07-20 16:34:32 +0200
commit74cb1477bb921a2378ea22a552b71a48c11e0931 (patch)
tree621ab17315be667c16dad8f3d5f44d67a7a47e8f /api/Users/Repositories/UserRepository.php
parent400591b34d4b0a6288834539808a9dede8a60e3a (diff)
Better API (integrated oauth completely)
Diffstat (limited to 'api/Users/Repositories/UserRepository.php')
-rw-r--r--api/Users/Repositories/UserRepository.php35
1 files changed, 35 insertions, 0 deletions
diff --git a/api/Users/Repositories/UserRepository.php b/api/Users/Repositories/UserRepository.php
new file mode 100644
index 0000000..68416df
--- /dev/null
+++ b/api/Users/Repositories/UserRepository.php
@@ -0,0 +1,35 @@
+<?php
+
+namespace Api\Users\Repositories;
+
+use Api\Users\Models\User;
+use Infrastructure\Database\Eloquent\Repository;
+
+class UserRepository extends Repository
+{
+ public function getModel()
+ {
+ return new User();
+ }
+
+ public function create(array $data)
+ {
+ $user = $this->getModel();
+
+ $data['password'] = password_hash($data['password'], PASSWORD_BCRYPT);
+
+ $user->fill($data);
+ $user->save();
+
+ return $user;
+ }
+
+ public function update(User $user, array $data)
+ {
+ $user->fill($data);
+
+ $user->save();
+
+ return $user;
+ }
+}