1 | <?php namespace Modules\User\Repositories\Usher; |
||
11 | class UsherUserRepository implements UserRepository |
||
12 | { |
||
13 | /** |
||
14 | * @var UsherUserRepo |
||
15 | */ |
||
16 | protected $user; |
||
17 | |||
18 | /** |
||
19 | * @var RoleRepository |
||
20 | */ |
||
21 | protected $role; |
||
22 | |||
23 | /** |
||
24 | * @param UsherUserRepo $user |
||
25 | * @param RoleRepository $role |
||
26 | */ |
||
27 | public function __construct(UsherUserRepo $user, RoleRepository $role) |
||
32 | |||
33 | /** |
||
34 | * Returns all the users |
||
35 | * @return object |
||
36 | */ |
||
37 | public function all() |
||
41 | |||
42 | /** |
||
43 | * Create a user resource |
||
44 | * @param $data |
||
45 | * @return mixed |
||
46 | */ |
||
47 | public function create(array $data) |
||
76 | |||
77 | /** |
||
78 | * Create a user and assign roles to it |
||
79 | * @param array $data |
||
80 | * @param array $roles |
||
81 | * @param bool $activated |
||
82 | * @return mixed |
||
83 | */ |
||
84 | public function createWithRoles($data, $roles, $activated = false) |
||
100 | |||
101 | /** |
||
102 | * Find a user by its ID |
||
103 | * @param $id |
||
104 | * @return mixed |
||
105 | */ |
||
106 | public function find($id) |
||
110 | |||
111 | /** |
||
112 | * Update a user |
||
113 | * @param $user |
||
114 | * @param $data |
||
115 | * @return mixed |
||
116 | */ |
||
117 | public function update($user, $data) |
||
150 | |||
151 | /** |
||
152 | * @param $userId |
||
153 | * @param $data |
||
154 | * @param $roles |
||
155 | * @internal param $user |
||
156 | * @return mixed |
||
157 | */ |
||
158 | public function updateAndSyncRoles($userId, $data, $roles) |
||
175 | |||
176 | /** |
||
177 | * Deletes a user |
||
178 | * @param $id |
||
179 | * @throws UserNotFoundException |
||
180 | * @return mixed |
||
181 | */ |
||
182 | public function delete($id) |
||
188 | |||
189 | /** |
||
190 | * Find a user by its credentials |
||
191 | * @param array $credentials |
||
192 | * @return mixed |
||
193 | */ |
||
194 | public function findByCredentials(array $credentials) |
||
198 | } |
||
199 |